Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variables in global.asa??

Status
Not open for further replies.

Frank123

MIS
Sep 17, 2001
77
US
Here's my problem. I'm trying to add different security levels to my website by using session variables. I've got an updatable grid on my pages that I want only read only for some users and full access for others. The only way I could think of to make this possible is to make 2 data source names. I put the following if statement into global.asa:

Sub Application_OnStart

dim DSNname
if (session("Usr") = "administrator")then DSNname = "DSN=Access2ASP;"
else
DSNname = "DSN=ReadonlyDB;"
end if

Application("Connection2_ConnectionString") = DSNname
Application("Connection2_ConnectionTimeout") = 15
Application("Connection2_CommandTimeout") = 30
Application("Connection2_CursorLocation") = 3
Application("Connection2_RuntimeUserName") = ""
Application("Connection2_RuntimePassword") = ""


Problem is it always reads in the session variable as "". I believe this is because my session variable gets created on my 2nd page of my website. Is there a way to call the Application_onstart from my login page???

Thanks for any help. :)
 
No.

These events are called by IIS/ASP only. There really is no reason to have different DSN's. The web user cannot see or directly affect the DSN or the database - but your code can. You should provide the features that are available within the code of each page.

Also, Application values are created JUST ONCE. ALL users get these values - so changing them will not be very useful.

Perhaps putting the DSN in a session variable would be better.

But just putting the correct logic in your page code to display/hide the edit features is the best (or at least the most usual) way. (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top