Hi,
If you want to do it using Application and session variable following are the steps for doing this:
1) When the user Logs in into the application set the session and application variables.
Login.asp
<%
Dim username
Dim userRights
'Set the session variables for username and his rights
Session("LoginName") = username
Session("Rights") = userRights
'Set the application variable
'Check if user is having Administrator rights
If(Session("Rights") = "Administrator")
if (Application("AdminLogin") = false) OR (Application("AdminLogin") = "")
Application.Lock()
'Make the adminstrative Login = true
Application("AdminLogin")= true
Application.Unlock()
else
Response.write("Login is not allowed")
end if
End if
%>
2) Now on Global.asa write the following code :
The following code will take care of the situation that if user closes the form by clicking on cross button of title bar.
Sub Application_OnEnd()
Application.Lock()
'Make the adminstrative Login = false
Application("AdminLogin")= false
Application.UnLock()
End Sub
Sub Session_OnEnd()
'Clear session variables
Session("LoginName") = ""
Session("Rights") = ""
End sub
I have done the same thing but the problem is that when he log out with the log off button it will run well as when he clicks on log off the value in database is again reset to 0 so this will run well.
but when he will close the site using close button on title bar then i cant change the value in database and set it to 0 so when he tries to login in again
he will not allowed as the value will be 1
now wat to do ??
So m thinkin of trying session or application events in Global.asa file
but how to use session or application variable ?
and wat to use session or application