IsPostBack but in ASP

Discussion in 'ASP General' started by Seb, Oct 3, 2007.

  1. Seb

    Seb Guest

    Hello,

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


    Thanks

    Sebastien
     
    Seb, Oct 3, 2007
    #1
    1. Advertising

  2. "Seb" <> wrote in message
    news:4703f4e6$0$14466$...
    > 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
     
    Anthony Jones, Oct 4, 2007
    #2
    1. Advertising

  3. Seb

    Seb Guest

    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$...
    > > 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
    >
    >
    >
     
    Seb, Oct 4, 2007
    #3
  4. ?
    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$...
    >>> 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.
     
    Bob Barrows [MVP], Oct 4, 2007
    #4
  5. "Seb" <> wrote in message
    news:...
    > 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
     
    Anthony Jones, Oct 4, 2007
    #5
  6. Seb

    Seb Guest

    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:...
    > > 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
    >
    >
    >
     
    Seb, Oct 5, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Baulch
    Replies:
    1
    Views:
    975
    Nathan Baulch
    Jun 26, 2003
  2. Joey
    Replies:
    2
    Views:
    3,985
  3. Kenneth Baltrinic
    Replies:
    1
    Views:
    512
    bruce barker
    May 31, 2007
  4. Kenneth Baltrinic
    Replies:
    1
    Views:
    771
    bruce barker
    Jun 4, 2007
  5. Seb

    IsPostBack for ASP

    Seb, Oct 3, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    839
    Cowboy \(Gregory A. Beamer\)
    Oct 3, 2007
Loading...

Share This Page