Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Removing browser cache

 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to do a logout action in my session. When I press logout it is redirected to a new page and the session is invalidated. In the previous page I am using validation logic to validate my session. When I press back button I get the previous page which should not be displayed if the session is invalidated. So I used following headers to remove chaching in the browser.

response.setHeader("Cache-Control", "no-store, no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);

But when I am using this there were few problems. I am passing serveral request parameters at runtime. As soon as I press refresh all my parameters get null. So how do you avoid this scenario.

Is there another way to do this thing done
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dilshan Edirisuriya:
As soon as I press refresh all my parameters get null.

You'll need to expand on what you mean by this.
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means I cannot view the request parameters which I got after doing a page refresh.
[ January 07, 2008: Message edited by: Dilshan Edirisuriya ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Request parameters or request attributes?

Your request parameters (form parameters or querystring variables) should survive a page refresh. Attributes, on the other hand will not.

Take a little time to explain exactly what you're doing and exactly what you're trying to accomplish. Once we understand, someone should be able to help you.
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ben and Bear for your kind consideration.

It solved it was a programmatic error done by me. Now I am facing another problem. When I keep on pressing the browser back button after removing the cache I get a page not available massege. (Offline displayed page of IE) I removed the cache of all the pages so they are working fine. What have I done wrong to get such a result.

Is this the only way(removing cache) to cope up with logout session. Is there another approach. I have seen in some system they use javascript to handle this. They simply create an intermediate page and forward to that page. They use a "onload" submit to forward to the final page so that if you press back button it keep on forwarding to the final page. But is that a good solution. As soon as you disable javascript from firefox it wont work. You can go back simply.
[ January 07, 2008: Message edited by: Dilshan Edirisuriya ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic