Lets Have a fun with Technology.

BTemplates.com

Follow by Email

Thursday, April 30, 2009

How to restrict a user getting access to pages after logout


Problem :- How to restrict a user getting access to pages after logout

Solution :-

First Solution :-

You need to stop the browser from caching your pages,
place the following code in the Page_Load function of any page that you want to prevent the browse from caching it.

Response.Cache.SetCacheability(HttpCacheability.NoCache);

If you are using Master pages then u can also put this code in master
So each page can not access after logout.

Second Solution :-

if you are using Session in application then call abondon metohd for Session Destroy and then Redirect to login Page.Check Session in Master Pages if It's Not Exists then u can redirect user to other Page.


But First One is good One for this.

1 comment:

  1. Thanks.

    I am Searching this from Long time.

    ReplyDelete