简体   繁体   中英

asp.net logout authentication how to code?

have completed the basic user login asp.net authentication services as well as the web data service. Now I am supposed to add the logout service. I was told that when the user logs out currently, 'they are not really logged out' in fact what happens is that you can back browser back into the app it reloads, so it is a security problem as you can imagine. I am looking at some code from another developer here, is that all I need then the last bit about the logout? How to I call this method? Currently the logout is quite simple here:

<HyperlinkButton content="Logout" NavigateURI="Http://www.mymainwebsite.com" />

how to code it now with respect to the logout authentication issue?


FormsAuthentication.SignOut();

Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddDays(-1);

MSDN is telling me that you should call Abandon on the state.

http://msdn.microsoft.com/en-us/library/ms178581.aspx

(Which they talk about in more detail, here: http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstatecontainer.abandon.aspx )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM