How to create a LOGOUT Page using Sessions

Hi Friends I am already explained in my previous post how to create Login Page in asp net Click Here.
Now i am going to explain you how to create a Logout Page

 First open the Microsoft visual studio 2008

Next, add one Web Form and change the name as Logout.aspx
Next, open the code page that is Logout.aspx.cs
And write the following code in the page load

protected void Page_Load(object sender, EventArgs e)
{
Session.Abandon();
Session.Remove("Username");
FormsAuthentication.SignOut();
// Response.Redirect(Request.UrlReferrer.ToString());
Response.Redirect("Logout.aspx");

}

That’s it. If you have any queries please let me know.i am always ready to share my knowledge with you..
developercode
About the Author
Sayyad is a Software Engineer, Blogger and Founder of Developers Code from India.His articles mainly focus on .Net (Web and Windows based applications), Mobile Technologies (Android,IPhone,BlackBerry) and SEO.

Facebook Rss Twitter

Get Weekly News letter of Updates!