poornima
poornima

Reputation: 31

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache) not working

I have used HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache) in the page load event in all pages

After logging off, when the browser back button is pressed,

the textbox values of username and password still exist.

Since the values are not cleared, the user can log in to the system without entering the username and password.

How to clear the textbox values? How to solve this issue?

Thanx in advance.

Upvotes: 2

Views: 7098

Answers (3)

SushiGuy
SushiGuy

Reputation: 1627

Two things:

  • Make sure the FORM tag has the attribute autocomplete="off" (the browser could be storing these values independent of HTML cache settings)
  • Make sure the web browser is set to download newer versions of stored pages "automatically" or "always" (Internet Explorer can sometimes be set to "never" download fresh pages)

Upvotes: 0

deepu
deepu

Reputation: 2029

Try this code, hope it works

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));

Response.Cache.SetNoStore();

Upvotes: 1

Jordan
Jordan

Reputation: 5425

this may help: http://forums.asp.net/t/1308836.aspx . If not, please provide some more context (are you using ASP.NET? Are you using a proxy (e.g. Fiddler)? etc..)

Upvotes: 0

Related Questions