Tuesday, December 8, 2009

Log Out Funcationality in ASP.Net

to implement the log out functionality in asp.net application use the following code in the body of log out button event handler

                Session.Clear();
                Session.Abandon();
                Response.Clear();
                Response.Redirect(context.LoginPage);
and to prevent back feature of the browser or accessing the website after log out using the following line

                HttpContext.Current.Response.Cache.SetExpires(DateTime.Now);

No comments:

Post a Comment