Ask a Question related to ASP Components, Design and Development.
-
adam #1
How to differentiate ASP page Refresh versus Requested by other pa
Hi ASP Expert,
I encounter a page reload situation in ASP.
It is I need a way to differentiate whether the current page -
"Application_Result.asp" got reloaded itself when user click on the browser
Refresh button or is requested by the previous page "Application_Form.asp".
I tried using
<%if Request.ServerVariables("REQUEST_METHOD") = "POST" then%>
<!--it is requested from "Application_Form.asp, do something-->
<%else%>
<!--Application_Result.asp refreshed itself(such as user clicks on the
browser Refresh button, do something else-->
<%end if%>
However, in both cases, the IF statement above all evaluated as true.
Any idea about how to differentiate this two different behavior (Page
Refresh versus Page requested by another Page) ?
Thanks for your help!
-adam
adam Guest
-
how can i Refresh my page????
Please help me I am using mac os x and Dreamweaver MX 2004, But i make some page but I am not abble to see them normal, please help me....I will... -
Page Refresh
OK, I have created a user control that contains a dropdown for office locations. Here is the code.... Private Sub Page_Load(ByVal sender As... -
page refresh?
I have the submit and action page. On the submit form, I have several text boxes for user to enter information. On the action page, I have the... -
Two questions: datagrid with string[] and how to differentiate between columns
This is my first attempt at creating an ASP.Net app and first using the datagrid. Seems pretty nice but there are some peculiarities I can't figure... -
refresh a page every so often
I want to refresh the text of a label box, say, every second. Is there a way to maintain some kind of persistent connection to the server and the... -
Anthony Jones #2
Re: How to differentiate ASP page Refresh versus Requested by other pa
"adam" <adam@discussions.microsoft.com> wrote in message
news:BFA43B05-8897-4931-85F6-F223614DADFD@microsoft.com...browser> Hi ASP Expert,
>
> I encounter a page reload situation in ASP.
> It is I need a way to differentiate whether the current page -
> "Application_Result.asp" got reloaded itself when user click on the"Application_Form.asp".> Refresh button or is requested by the previous pageA referesh will use the same method to request the resource. If the page is>
> I tried using
> <%if Request.ServerVariables("REQUEST_METHOD") = "POST" then%>
> <!--it is requested from "Application_Form.asp, do something-->
> <%else%>
> <!--Application_Result.asp refreshed itself(such as user clicks on the
> browser Refresh button, do something else-->
> <%end if%>
>
> However, in both cases, the IF statement above all evaluated as true.
> Any idea about how to differentiate this two different behavior (Page
> Refresh versus Page requested by another Page) ?
>
> Thanks for your help!
>
> -adam
navigated to by means of a POST then the browser will use a POST to refresh
(it keeps a copy of the original request body in order to do that). So
REQUEST_METHOD doesn't help. Even the Referrer header remains the same.
The only difference in the request generated by a refresh is the inclusion
of a Pragma: nocache header and a Cache-Control: max-age=0 which will force
any cache/proxy between the browser and the origin server to forward the
request to the server. Unfortunately these headers are not exposed in the
ServerVariables property.
I'm gonna guess you are trying to prevent a Form post duplicating activities
when the user refreshes the resulting page.
Add a hidden field to the original form to hold a unique transaction ID ( a
GUID or sequential number). When you have processed the posted data, mark
the transaction ID as processed. In your processing page before doing
anything else check that the transaction ID hasn't already been processed.
If it has just do the output part of the page.
Anthony.
Anthony Jones Guest



Reply With Quote

