473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASP.NET - Logout from code

How do you logout from an account from the ASP.NET code?
Aug 23 '06 #1
3 10448
How are you logged in? If it uses forms authentication, use

FormsAuthentication.SignOut

http://msdn2.microsoft.com/en-us/lib...n.signout.aspx

Ken
Microsoft MVP [ASP.NET]

"JackResteBienSurMaisSeraPas" <Ja*************************@hotmail.com>
wrote in message news:wh******************@wagner.videotron.net...
How do you logout from an account from the ASP.NET code?

Aug 23 '06 #2
Also to add to Kens post
You might need to make sure that none of the pages are cached. If you're
using a master page, you can put the following code at the beginning of
Page_Load
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader("pragma","no-cache")
Response.AddHeader("cache-control","private")
Response.CacheControl = "no-cache"

Hope that helps
Patrick

"Ken Cox [Microsoft MVP]" <BA**********@newsgroups.nospamwrote in message
news:#F**************@TK2MSFTNGP05.phx.gbl...
How are you logged in? If it uses forms authentication, use

FormsAuthentication.SignOut

http://msdn2.microsoft.com/en-us/lib...ormsauthentica
tion.signout.aspx
>
Ken
Microsoft MVP [ASP.NET]

"JackResteBienSurMaisSeraPas" <Ja*************************@hotmail.com>
wrote in message news:wh******************@wagner.videotron.net...
How do you logout from an account from the ASP.NET code?


Aug 23 '06 #3
dgk
On Wed, 23 Aug 2006 17:33:34 +1000, "Patrick.O.Ige"
<na********@hotmail.comwrote:
>Also to add to Kens post
You might need to make sure that none of the pages are cached. If you're
using a master page, you can put the following code at the beginning of
Page_Load
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader("pragma","no-cache")
Response.AddHeader("cache-control","private")
Response.CacheControl = "no-cache"

Hope that helps
Patrick
This seems to work well. Is there a reason not to use it?
Sep 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: crescent_au | last post by:
Hi all, I've written a login/logout code. It does what it's supposed to do but the problem is when I logout and press browser's back button (in Firefox), I get to the last login page. In IE,...
12
kamill
by: kamill | last post by:
I have done a logout page for logout from admin section and provides a link to logout from admin section.Whenever i clicked on logout link it redirected to index.php of admin section......BUT when i...
6
by: chaos | last post by:
HELLO ,All ANYONE know how to do the alert message for logout.Example "Yes" OR "NO" in the message box. <td><?php if(isset($_SESSION)) { ?> <strong><a...
10
by: chaos | last post by:
How to do logout alert message when i press on the logout image <a href="../logout.php" target="_top" onClick="return logout()"...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
1
by: Kandiman | last post by:
Hiya, i made a asp page, and one of my divs (as a include) is as below. the problem is if the main page is resubmitted, i get logged out again?... heres the code.. i think its on the value=true...
4
by: shahidrasul | last post by:
hi in my project when i click on logout anchor it goes to logout page and my code in logout page is if (Session != null) { Session = null; Session.Abandon(); ...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
5
by: vinodsk101 | last post by:
Hi all, I am developing a web application. I am using Servlet and JSP. After logout the user should not able to see the previous pages and page should navigate to loginpage.jsp. I have used...
1
by: phpuser123 | last post by:
Hi,I have created a script where I want to use onclick event and javascript to log out.Here r my coodes .. <script type="text/javascript"> function logout(){ <?php...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.