IsPostBack but in ASP
am 03.10.2007 22:00:27 von SebHello,
Is there the IsPostBack command in ASP (not ASP.net) ?
Or How can I detect a refresh in a ASP page ?
Thanks
Sebastien
Hello,
Is there the IsPostBack command in ASP (not ASP.net) ?
Or How can I detect a refresh in a ASP page ?
Thanks
Sebastien
Hello
Sorry but it's good to detect a POST but not to detect a refresh.
Thanks
Sebastien
"Anthony Jones" wrote:
> "Seb" wrote in message
> news:4703f4e6$0$14466$426a74cc@news.free.fr...
> > Hello,
> >
> > Is there the IsPostBack command in ASP (not ASP.net) ?
> > Or How can I detect a refresh in a ASP page ?
> >
> >
> > Thanks
> >
> > Sebastien
> >
>
> Function IsPostBack()
> IsPostBack = (Request.ServerVariables("REQUEST_METHOD") = "POST")
> End Function
>
>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>
?
Not even .Net's IsPostBack method can distinguish between an initial
page request and a subsequent page refresh ...
To do that, you will probably need to use a session variable to track
when the page is initially requested
Seb wrote:
> Hello
>
> Sorry but it's good to detect a POST but not to detect a refresh.
>
> Thanks
>
> Sebastien
>
>
>
> "Anthony Jones" wrote:
>
>> "Seb" wrote in message
>> news:4703f4e6$0$14466$426a74cc@news.free.fr...
>>> Hello,
>>>
>>> Is there the IsPostBack command in ASP (not ASP.net) ?
>>> Or How can I detect a refresh in a ASP page ?
>>>
>>>
>>> Thanks
>>>
>>> Sebastien
>>>
>>
>> Function IsPostBack()
>> IsPostBack = (Request.ServerVariables("REQUEST_METHOD") = "POST")
>> End Function
>>
>>
>>
>>
>> --
>> Anthony Jones - MVP ASP/ASP.NET
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
"Seb"
news:F6DCB5FC-78EB-49B5-A6B2-7364DDCB6A80@microsoft.com...
> Hello
>
> Sorry but it's good to detect a POST but not to detect a refresh.
>
> Thanks
>
> Sebastien
>
I see. Most refreshes are accompanied with a pragma: no-cache header but
that isn't guaranteed nor is it guaranteed that the initial request will not
be accompanied by the header.
The best way to ensure you don't reprocess the same post is to add a hidden
field containing a unique ID (such as a GUID) to the form.
When you've processed the POST of the form make a record of the UniqueID to
mark that its been processed. Before processing a POST check that you
haven't got a record of that POST already.
--
Anthony Jones - MVP ASP/ASP.NET
Thank you everybody
Finally I have used a Session variable to save the last post but it's not a
unique ID because my unique ID is calculated when I have a new post.
By
Sébastien
"Anthony Jones" wrote:
> "Seb"
> news:F6DCB5FC-78EB-49B5-A6B2-7364DDCB6A80@microsoft.com...
> > Hello
> >
> > Sorry but it's good to detect a POST but not to detect a refresh.
> >
> > Thanks
> >
> > Sebastien
> >
>
> I see. Most refreshes are accompanied with a pragma: no-cache header but
> that isn't guaranteed nor is it guaranteed that the initial request will not
> be accompanied by the header.
>
> The best way to ensure you don't reprocess the same post is to add a hidden
> field containing a unique ID (such as a GUID) to the form.
>
> When you've processed the POST of the form make a record of the UniqueID to
> mark that its been processed. Before processing a POST check that you
> haven't got a record of that POST already.
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>