Click here to Skip to main content
12,452,344 members (58,947 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL-Server SQL-Server-2008 , +
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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 10 Dec 2012
Copyright © CodeProject, 1999-2016
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