Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > IsPostBack but in ASP

Reply
Thread Tools

IsPostBack but in ASP

 
 
Seb
Guest
Posts: n/a
 
      10-03-2007
Hello,

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


Thanks

Sebastien




 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      10-04-2007
"Seb" <(E-Mail Removed)> wrote in message
news:4703f4e6$0$14466$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
Seb
Guest
Posts: n/a
 
      10-04-2007
Hello

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

Thanks

Sebastien



"Anthony Jones" wrote:

> "Seb" <(E-Mail Removed)> wrote in message
> news:4703f4e6$0$14466$(E-Mail Removed)...
> > 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
>
>
>

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-04-2007
?
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" <(E-Mail Removed)> wrote in message
>> news:4703f4e6$0$14466$(E-Mail Removed)...
>>> 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.


 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      10-04-2007
"Seb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
Seb
Guest
Posts: n/a
 
      10-05-2007
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Do IsPostBack and Master.IsPostBack Always Fire Twice? Joey ASP .Net 2 10-09-2008 06:17 AM
IsPostBack for ASP Seb ASP .Net 4 10-03-2007 08:23 PM
On postback, EVENTTARGET is populated but IsPostback == false, no events fire?! Kenneth Baltrinic ASP .Net 1 06-04-2007 03:10 PM
__EVENTTARGET correct but events don't fire and IsPostback == false? Kenneth Baltrinic ASP .Net 1 05-31-2007 07:28 PM
Manually get the text that a certain control posted when in IsPostBack mode... Nathan Baulch ASP .Net 1 06-26-2003 05:38 AM



Advertisments