Raise an event or override a method when the user logs out in ASP.NET
I need to do something when the user logs out. I have used ASP.NET Forms Authentication.
What should 开发者_高级运维I override or implement?
I have an ASP.NET login control and I want to empty the basket-viewer when the customer logs out of the system.
You should handle the event in Global::Application_Logout
.
One common approach is program the task you want in the global.asax file. You have the event Session_End that will occur when you logout with forms authentication. Other would do the task on the logout click event. The latter is very NOT recommended, though, because that will leave your tasks undone if the user times out the session (i.e. closing browser).
精彩评论