IsPostBack but in ASP

IsPostBack but in ASP

am 03.10.2007 22:00:27 von Seb

Hello,

Is there the IsPostBack command in ASP (not ASP.net) ?
Or How can I detect a refresh in a ASP page ?


Thanks

Sebastien

Re: IsPostBack but in ASP

am 04.10.2007 09:38:13 von Anthony Jones

"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

Re: IsPostBack but in ASP

am 04.10.2007 10:19:00 von Seb

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
>
>
>

Re: IsPostBack but in ASP

am 04.10.2007 14:18:56 von reb01501

?
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.

Re: IsPostBack but in ASP

am 04.10.2007 14:25:43 von McKirahan

"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 ?

Will something lke this work for you?

It uses Session variables to identify the current page
and its counter.

Create "refresh1.asp" then copy it to "refresh2.asp"
and change the value of "cASP" to "refresh2.asp".

Call it via http://{your domain}/refresh1.asp then
click the links and watch the page+counter display.
Clicking "Refresh" will increment the counter as well.

<%@ Language="VBScript" %>
<% Option Explicit
Const cASP = "refresh1.asp"
If Session("ASP") <> cASP _
Or Session("CTR") = "" Then
Session("CTR") = 0
Else
Session("CTR") = Session("CTR") + 1
End If
Session("ASP") = cASP
%>


<%=Session("ASP")%> : <%=Session("CTR")%>





Re: IsPostBack but in ASP

am 04.10.2007 19:10:07 von Anthony Jones

"Seb" wrote in message
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

Re: IsPostBack but in ASP

am 05.10.2007 10:14:00 von Seb

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" wrote in message
> 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
>
>
>