?
Solved

how to make logout in asp?

Posted on 2009-04-26
6
Medium Priority
?
300 Views
Last Modified: 2012-05-06
how to expire/destroy session in asp?

can u please tell me the code of logout ?
0
Comment
Question by:designersx
6 Comments
 
LVL 6

Expert Comment

by:JoachimMartinsen
ID: 24239176
¨
session("youreSessionNameForLoggedIn") = false
 
OR
 
session("youreSessionNameForLoggedIn") = ""

Open in new window

0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 24239203
logout usually means destroy all session variables, so try use command:

Session.Abadon

instead.
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 24239209
typo..

should be:

Session.Abandon
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 54

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 24239214
after the command above , redirect it to login page:

logout.asp

<%

Session.Abandon
Response.Redirect "login.asp"

%>
0
 
LVL 2

Expert Comment

by:its_parikshit
ID: 24239468
try


session=nothing

if session.Abandon doesn't work


'try 
 
session=Nothing
 
 
'if session.abandon doesn't work

Open in new window

0
 
LVL 3

Expert Comment

by:RobbP
ID: 24239494
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="true" 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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question