Is there an IsPostback() function in ASPRSS

6 replies

Last post Nov 11, 2019 03:06 PM by yaguarete79

‹ Previous Thread|Next Thread ›
  • Is there an IsPostback() function in ASP

    Oct 05, 2004 02:34 PM|AlexB1318|LINK

    Got a legacy ASP application that I need to determine whether the page is being posted back or if it's the first time...is there an IsPostback() function (like the one in .NET) or something similar in ASP? I can check a query string parameter to solve my immediate problem but I was curious if such a function exists.
  • Re: Is there an IsPostback() function in ASP

    Oct 05, 2004 03:25 PM|tomkmvp|LINK

    No - that's purely ASP.NET.
    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Is there an IsPostback() function in ASP

    Oct 05, 2004 06:49 PM|netguy|LINK

    Nope, the QueryString or Form request should tell you... You can also write your own IsPostBack Function Function IsPostBack() If Request.Form("submit") <> Empty Then Return True Else Return False End If End Function Enjoy!
    ~ Innovative Modules @ Inspector IT
    ~ I Blog @ CTO 2.0
  • Re: Is there an IsPostback() function in ASP

    Jun 23, 2016 04:35 PM|sonicparks|LINK

    Function IsPostBack()

    Return Request.Form.Count > 0

    End Function

  • Re: Is there an IsPostback() function in ASP

    Sep 05, 2016 06:59 AM|Ken Schaefer|LINK

    Request.ServerVariables("Request_Method") holds the HTTP verb used to make the request. No need to rely on proxies like counting the number of values in the .Form collection (what if there are legitmately none?)

    Function IsPostBack()

    If Request.ServerVariables("Request_Method") = "POST" Then

       Return True

    Else

       Return False

    End If

    End Function

  • Re: Is there an IsPostback() function in ASP

    Sep 05, 2016 03:55 PM|milope|LINK

    Still if it's a Postback, you have to ensure the Referrer and URL are the same.
  • Re: Is there an IsPostback() function in ASP

    Nov 11, 2019 03:06 PM|yaguarete79|LINK

    In my application, I had to slightly change the code syntax to make this function work. Instead of using the keyword "Return" which was not recognized (I'm not sure why), I had to set the Function name to the resulting value. By this I mean the following:

    Function IsPostBack()
         If Request.Form("submit") <> Empty Then
              IsPostBack = True
         Else
              IsPostBack = False
         End If
    End Function

‹ Previous Thread|Next Thread ›