开发者

asp.net logout authentication how to code?

开发者 https://www.devze.com 2023-02-08 04:35 出处:网络
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, \'th

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:

<Hyperlin开发者_运维百科kButton 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消