Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. HttpMethod and PostBack Testing

HttpMethod and PostBack Testing

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nettestingbeta-testing
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KaptinKrunch
    wrote on last edited by
    #1

    Just a quick question. Is this test logical or possible in ASP.NET? If so, under what scenario(s) would you expect to see such a positive result of the test. Thanks

    if (Request.HttpMethod == "POST" && !IsPostBack)
    {...}

    Just because we can; does not mean we should.

    L J 2 Replies Last reply
    0
    • K KaptinKrunch

      Just a quick question. Is this test logical or possible in ASP.NET? If so, under what scenario(s) would you expect to see such a positive result of the test. Thanks

      if (Request.HttpMethod == "POST" && !IsPostBack)
      {...}

      Just because we can; does not mean we should.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I ain't no web-programmer, but sounds like homework, and I know where the documentation is, so shouldn't be too hard to come up with something. Let's try. HttpRequest.HttpMethod[^]

      Gets the HTTP data transfer method (such as GET, POST, or HEAD) used by the client.

      Docs also state it's a String, so the first part of the evaluation looks correct. The English implies that the Request was a POST action on the server. IsPostBack looks like a property, not a method. Guess it must be part of the Page[^].

      Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.

      Ah, interesting. So, the block would be executed if:

      • It's being POST-ed
      • It's not a postback (meaning, the page is being rendered the first time)

      The action is determined in the Form;

      <form name="input" action="html_form_action.asp" method="post">

      ..and that is why I kinda like MSDN. Hope this helps a bit :)

      Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

      K 1 Reply Last reply
      0
      • L Lost User

        I ain't no web-programmer, but sounds like homework, and I know where the documentation is, so shouldn't be too hard to come up with something. Let's try. HttpRequest.HttpMethod[^]

        Gets the HTTP data transfer method (such as GET, POST, or HEAD) used by the client.

        Docs also state it's a String, so the first part of the evaluation looks correct. The English implies that the Request was a POST action on the server. IsPostBack looks like a property, not a method. Guess it must be part of the Page[^].

        Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.

        Ah, interesting. So, the block would be executed if:

        • It's being POST-ed
        • It's not a postback (meaning, the page is being rendered the first time)

        The action is determined in the Form;

        <form name="input" action="html_form_action.asp" method="post">

        ..and that is why I kinda like MSDN. Hope this helps a bit :)

        Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

        K Offline
        K Offline
        KaptinKrunch
        wrote on last edited by
        #3

        Thanks for the reply, not quite the answer I was hoping for, but thanks anyway. p.s. its not "homework" in the traditional sense but rather me attempting to expand my knowledge on my own time.

        Just because we can; does not mean we should.

        L 1 Reply Last reply
        0
        • K KaptinKrunch

          Thanks for the reply, not quite the answer I was hoping for, but thanks anyway. p.s. its not "homework" in the traditional sense but rather me attempting to expand my knowledge on my own time.

          Just because we can; does not mean we should.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          KaptinKrunch wrote:

          me attempting to expand my knowledge

          Good to hear that there are still people learning voluntarily :thumbsup:

          KaptinKrunch wrote:

          not quite the answer I was hoping for, but thanks anyway.

          'twas a bit rude, but it seemed like a good idea to explain how I reached the conclusion on what the code "theoretically" would do. If you have suggestions on how my answers would be improved, by all means, hit me :-D

          Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

          1 Reply Last reply
          0
          • K KaptinKrunch

            Just a quick question. Is this test logical or possible in ASP.NET? If so, under what scenario(s) would you expect to see such a positive result of the test. Thanks

            if (Request.HttpMethod == "POST" && !IsPostBack)
            {...}

            Just because we can; does not mean we should.

            J Offline
            J Offline
            jkirkerx
            wrote on last edited by
            #5

            Theres POST and GET on the browser side http://www.cs.tut.fi/~jkorpela/forms/methods.html[^] IsPostback is internal to asp.net, I'm not aware of isPostback in PHP or anything

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups