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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set an application variable?

Status
Not open for further replies.

therick

Programmer
Mar 20, 2001
34
US
I have a series of asp pages that I need to secure. I have a login page that authenticates to a SQL table with usernames and passwords. Upon validation to SQL, the user is redirected to a page to post a string of data. Problem is, as you probably expected, you can skip the login screen and go directly to the post page if you know the url. How do I set an application level variable to true when the login succeeds on the Login.asp page and check to be sure that the value is still set to true on the Post page? In other words, the variable would only be set to true if validated against the passwords table and the post page would check the value of this variable before performing any actions. Thanks for any help here.
 
It seems like you want to handle things on a session level, not an application level. Application == global, Session == local. If you were to change the Application variable, then only one user could go to your post page at a time. I don't think that this is your desired functionality, but then again I might be wrong.

Anyhow - here's the syntax for both.
for application:

'you need to lock it to make sure that no else in
'the app alters the variable at the same time
Application.Lock
Application("booleanVar") = true
Application.Unlock


for session:

'no locking needed, since each user gets his/her own session
'so there will never be conflict issues
Session("booleanVar") = true

hope this helps
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top