IsPostBack but in ASP

S

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
 
A

Anthony Jones

Seb said:
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
 
S

Seb

Hello

Sorry but it's good to detect a POST but not to detect a refresh.

Thanks

Sebastien
 
B

Bob Barrows [MVP]

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

Anthony Jones

Seb said:
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.
 
S

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top