views:

33

answers:

0

I Wrote an Http Module that checks if logged user is restricted disables images on the page.

void application_AuthorizeRequest(object sender, EventArgs e)
{
.
.
.

 if (context.User.IsInRole("Restricted") && 
  Path.GetExtension(context.Server.MapPath(context.Request.FilePath)).ToLower() == ".jpg")
       {
           context.Response.StatusCode = 401;
           context.Response.End();
       }

The code works fine. When the page loads, every image on the screen disapears. but when I go to another page and click back button on the browser and goto previous page images appear. What should I do?

(I dont want to clear Cache every time)

context.Response.Cache.SetNoStore();
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);