Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hii to all, iam developing a login page,whear user can register and can login to my page,up to this i have done, hear i want to provide a logout button for user to get back to his previous page i.e Home page, can u please send me the code for logout..thanks in advance
 

with regards
D Ramu
Posted 9-Dec-12 20:57pm
Comments
@AmitGajjar at 10-Dec-12 3:01am
   
Noone will give you the code, what you can do is. Do some selfwork and if you have any issue then post your question.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Assuming you are using Membership (and if you aren't, you should), try:
FormsAuthentication.SignOut();
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you're using Session :
Session.Abandon();
Response.Redirect("home.aspx");
or else Solution #1 is correct as well..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Session.Clear();
Session.Abandon();
Response.Redirect("Home.aspx");
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Gihan Liyanage 332
1 Sergey Alexandrovich Kryukov 250
2 ClimerChinna 222
3 vikinghunter 188
4 OriginalGriff 161
0 Sergey Alexandrovich Kryukov 8,373
1 OriginalGriff 7,112
2 CPallini 2,598
3 Richard MacCutchan 2,025
4 Abhinav S 1,788


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 10 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100