This discussion is archived
2 Replies Latest reply: May 26, 2012 2:23 AM by 939890 RSS

How to check if its a PostBack?

srhcan Newbie
Currently Being Moderated
How can I check if its a PostBack on server-side? TIA
  • 1. Re: How to check if its a PostBack?
    gimbal2 Guru
    Currently Being Moderated
    Well one way would be to actually properly use GET and POST requests for what they are intended - a postback can by convention be a POST request for example.

    You could also add something on the postback through a hidden form field, some form of token that you could also use to check for form resubmission.
  • 2. Re: How to check if its a PostBack?
    939890 Newbie
    Currently Being Moderated
    You need to check the value of the CONTENT-LENGTH server variable, which is one of the serverside environmental variables available post request. The CONTENT-LENGTH variable will be zero on initial request but greater than zero after a postback. Don't go testing the REQUEST-METHOD which can either be GET or POST. That has nothing to do with whether the page is a postback event or not. The REQUEST-METHOD only determines how the form data is posted back.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points