Hi,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you are looking for some approachs on how to prevent
Postback URL's from being added to the browser's history list so that
customer can only navigator to the initial view of a page or refresh again
to get a new version of the certain page.
If there is anything I misunderstood, please feel free to let me know.
First of all, I should confirm msdnalias's suggestion that use the
"SmartNavigation" property of the ASP.NET web page. This is a very good
solution. In fact, one of the functionality fo "SmartNavigation" property
is:
retaining only the last page state in the browser's history.
Thus, only the different navigatored page will be added to the history
list. The post back page with same url won't be added into. To enable the
"SmartNavigation" property, just change the certain page's
"smartNavigation" property to "true" in the property window of VS.NET, also
you can programmatically set it as below:
Page.SmartNavigation = true;
Also, there're many other wonderful features of the "smartNavigation"
property, for detailed info, you can view the following link in MSDN:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuipageclass
smartnavigationtopic.asp?frame=true
In addition, as for the history page which we can visit use the "back" or
"forward" button of IE, they're all the page cache on the client machine.
If you don't want the client cache for a certain, you may also manually
disable them on the serverside code, such as:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
}
Thus, if you request this page and then navigator to other pages or event
fire some post back events of the page and then use "back" button to go
back. The Browser will display the following information:
----------------------------------------------
Warning: Page has Expired The page you requested was created using
information you submitted in a form. This page is no longer available. As a
security precaution, Internet Explorer does not automatically resubmit your
information for you.
To resubmit your information and view this Web page, click the Refresh
button.
----------------------------------------------
Thus, will also force you to refresh the page and request a new version of
it. And here is a KB article which particularly discus on this tech topics,
you may have a look if you have interests:
#HOWTO: Prevent Caching in Internet Explorer
http://support.microsoft.com/?id=234067
Any way, please check out the preceding suggestions and choose the proper
one as you like. Also, if you feel them still not quite suitable for your
situation, please feel free to let me know. I'll be willing to help you
search for some other approachs.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)