Code of logout in c#.net

Try this code may this will help. Paste this code on masterpage’s load event.

If you are not using master pages then you have to paste this code of all the pages (on load event).


Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

On logout

You have to write

Session.Abandon();
Session.Clear();

And redirect to login page.

Comments

Anonymous said…
Code is helpful
Anonymous said…
thanx
Anonymous said…
Really code working fine

Popular posts from this blog

How to add Primary Key and Auto Increment on different fields of MySql

URL rewriting and SEO

Sql azure select from another database / Cross Database connection