IT Community - Software Programming, Web Development and Technical Support

How to disable back button in .Net?

This is a discussion on How to disable back button in .Net? within the ASP and ASP.NET Programming forums, part of the Web Development category; How to disable back button in .Net? For example if you consider this scenario, user gets data which can change ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-17-2007, 03:44 AM
bluesky bluesky is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 201
bluesky is on a distinguished road
Default How to disable back button in .Net?

How to disable back button in .Net? For example if you consider this scenario, user gets data which can change frequently from database to display it in the screen. From that screen user can go another page where he presses back button of browser to come back to this page again. During that time browser might show the page which is in cache because of which user might not see the approriate data

To avoid this you can open the browser without toolbar. So that user won’t see the back button. But in lots of cases we can’t do this. Other way for doing this is, don’t cache the page. So every time any page is requested it will go to the server. Hence user will get the current data.

For avoiding page to be cached, you need to set the following properties for response object.
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0
Response.CacheControl = "no-cache"

ExpiresAbsolute : Gets or sets the absolute date and time at which to remove cached information from the cache.

Expires : Gets or sets the number of minutes before a page cached on a browser expires. If the user returns to the same page before it expires, the cached version is displayed.

CacheControl : Sets the Cache-Control HTTP header to Public or Private. Possible values:
Public - may be cached in public shared caches
Private - may only be cached in private cache
no-cache - may not be cached
no-store - may be cached but not archived
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide toolbar except the back and next button saravanan HTML, CSS and Javascript Coding Techniques 0 03-19-2008 09:35 PM
I keep getting "Data Missing" when I click the "back" button in my browser. How can I oxygen HTML, CSS and Javascript Coding Techniques 1 07-28-2007 01:12 AM
Can I make a button on my page work as the browser's Back button in javascript? kingmaker HTML, CSS and Javascript Coding Techniques 1 07-26-2007 01:27 AM
How to disable back button on the browser? Jeyaseelansarc HTML, CSS and Javascript Coding Techniques 1 05-21-2007 12:44 AM
Disable Back Button ewriter HTML, CSS and Javascript Coding Techniques 1 04-24-2007 11:16 PM


All times are GMT -7. The time now is 01:27 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0