designersx
asked on
how to make logout in asp?
how to expire/destroy session in asp?
can u please tell me the code of logout ?
can u please tell me the code of logout ?
logout usually means destroy all session variables, so try use command:
Session.Abadon
instead.
Session.Abadon
instead.
typo..
should be:
Session.Abandon
should be:
Session.Abandon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try
session=nothing
if session.Abandon doesn't work
session=nothing
if session.Abandon doesn't work
'try
session=Nothing
'if session.abandon doesn't work
There are two types of sessions logouts - 1 which kills your user session, and one which killes your variables. The below code if inserted into your web config will destroy both and redirect the user to the login page:
<system.web>
<sessionState timeout="20" mode="InProc"/>
<authentication mode="Forms">
<forms loginUrl="UserLogin.aspx" defaultUrl="~/Default.aspx " name=".ASPXFORMSAUTH" enableCrossAppRedirects="t rue" protection="All" path="/" timeout="20"/>
</authentication>
</system.web>
This will end both sessions types ie 20, and direct users to the login page. You could also wire up the login control which would handle the pain of logging in and will use this config to automatically handle user sessions and logout procedures.
Let me know if this helps
<system.web>
<sessionState timeout="20" mode="InProc"/>
<authentication mode="Forms">
<forms loginUrl="UserLogin.aspx" defaultUrl="~/Default.aspx
</authentication>
</system.web>
This will end both sessions types ie 20, and direct users to the login page. You could also wire up the login control which would handle the pain of logging in and will use this config to automatically handle user sessions and logout procedures.
Let me know if this helps
Open in new window