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. Most secure way to submit hidden fields?

Most secure way to submit hidden fields?

Scheduled Pinned Locked Moved ASP.NET
questioncsharphtmltutorial
16 Posts 5 Posters 0 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.
  • N N a v a n e e t h

    InvalidTypecast wrote:

    I have concerns with this as hidden fields can be modified as its saved in the html on the client side.

    No problem. Client can view the hidden field. But he can't make changes to that.

    InvalidTypecast wrote:

    Can I simulate this in my codebehind in my aspx.cs file so that I don't have to worry about people messing with the values?

    Simulating hidden fields ? How you are going to do this ? Creating hidden fields from code behind ?

    Navaneeth My Website

    G Offline
    G Offline
    Guffa
    wrote on last edited by
    #5

    Navaneeth. wrote:

    Client can view the hidden field. But he can't make changes to that.

    Of course they can. Just view the source, edit it, save it as an html file on disk, and browse to it.

    Navaneeth. wrote:

    Simulating hidden fields ? How you are going to do this ? Creating hidden fields from code behind ?

    No. Just send the values as post data in a request.

    --- single minded; short sighted; long gone;

    N 1 Reply Last reply
    0
    • I InvalidTypecast

      I am reading paypal's instructions for integrating a custom shopping cart into their payment system on their website. They state an example would look something like this: I have concerns with this as hidden fields can be modified as its saved in the html on the client side. Can I simulate this in my codebehind in my aspx.cs file so that I don't have to worry about people messing with the values? I am using c#. What is my best bet? Thank you

      B Offline
      B Offline
      badgrs
      wrote on last edited by
      #6

      I don't understand why you have concerns, if the user changes the hidden fields either the payment won't go through or it will go to the wrong person/be the wrong amount (in which case its entirely their fault). I don't see that theres any confidential information there that you wouldn't want people to see, and as the form posts to a secure server no-one would be able to pick the request off the wire.

      I 1 Reply Last reply
      0
      • G Guffa

        Navaneeth. wrote:

        Client can view the hidden field. But he can't make changes to that.

        Of course they can. Just view the source, edit it, save it as an html file on disk, and browse to it.

        Navaneeth. wrote:

        Simulating hidden fields ? How you are going to do this ? Creating hidden fields from code behind ?

        No. Just send the values as post data in a request.

        --- single minded; short sighted; long gone;

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #7

        Guffa wrote:

        Of course they can. Just view the source, edit it, save it as an html file on disk, and browse to it.

        Yes that they can do. But how come they can post the data to paypal ?

        Navaneeth My Website

        G 1 Reply Last reply
        0
        • N N a v a n e e t h

          Guffa wrote:

          Of course they can. Just view the source, edit it, save it as an html file on disk, and browse to it.

          Yes that they can do. But how come they can post the data to paypal ?

          Navaneeth My Website

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #8

          What do you mean?

          --- single minded; short sighted; long gone;

          N 1 Reply Last reply
          0
          • G Guffa

            What do you mean?

            --- single minded; short sighted; long gone;

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #9

            I mean they can edit the values by saving to their computer. But they can't do anything with the values rite. Means sending that value to the server etc

            Navaneeth My Website

            G 1 Reply Last reply
            0
            • N N a v a n e e t h

              I mean they can edit the values by saving to their computer. But they can't do anything with the values rite. Means sending that value to the server etc

              Navaneeth My Website

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #10

              Of course they can. If you have a form on a web page, the user's browser is sending the form to paypal, so there is no difference if they make their own form and send to paypal.

              --- single minded; short sighted; long gone;

              I 1 Reply Last reply
              0
              • G Guffa

                Of course they can. If you have a form on a web page, the user's browser is sending the form to paypal, so there is no difference if they make their own form and send to paypal.

                --- single minded; short sighted; long gone;

                I Offline
                I Offline
                InvalidTypecast
                wrote on last edited by
                #11

                There are plugins now that actually make editing the html on a live page really easy. It's as simple as clicking an Edit HTML button and they can modify the live html and submit whatever they want. How would I post the values from the code behind?

                G 1 Reply Last reply
                0
                • G Guffa

                  You can use a WebRequest or a WebClient object to post a form from code behind.

                  --- single minded; short sighted; long gone;

                  I Offline
                  I Offline
                  InvalidTypecast
                  wrote on last edited by
                  #12

                  What would an example be using one of the Http methods you just mentioned given the format in my original post?

                  1 Reply Last reply
                  0
                  • B badgrs

                    I don't understand why you have concerns, if the user changes the hidden fields either the payment won't go through or it will go to the wrong person/be the wrong amount (in which case its entirely their fault). I don't see that theres any confidential information there that you wouldn't want people to see, and as the form posts to a secure server no-one would be able to pick the request off the wire.

                    I Offline
                    I Offline
                    InvalidTypecast
                    wrote on last edited by
                    #13

                    I don't want people changing the prices of things etc.

                    B 1 Reply Last reply
                    0
                    • I InvalidTypecast

                      I don't want people changing the prices of things etc.

                      B Offline
                      B Offline
                      badgrs
                      wrote on last edited by
                      #14

                      If you program it correctly that shouldn't matter - the response you get back from PayPal will contain the amount they paid, you can check that against how much they should of paid and if it doesn't match up show them an appropriate message. It won't affect a legitimate user and anyone who does it deliberately its their own fault.

                      I 1 Reply Last reply
                      0
                      • B badgrs

                        If you program it correctly that shouldn't matter - the response you get back from PayPal will contain the amount they paid, you can check that against how much they should of paid and if it doesn't match up show them an appropriate message. It won't affect a legitimate user and anyone who does it deliberately its their own fault.

                        I Offline
                        I Offline
                        InvalidTypecast
                        wrote on last edited by
                        #15

                        That's a good point badgrs, thank you

                        1 Reply Last reply
                        0
                        • I InvalidTypecast

                          There are plugins now that actually make editing the html on a live page really easy. It's as simple as clicking an Edit HTML button and they can modify the live html and submit whatever they want. How would I post the values from the code behind?

                          G Offline
                          G Offline
                          Guffa
                          wrote on last edited by
                          #16

                          InvalidTypecast wrote:

                          How would I post the values from the code behind?

                          Using a WebRequest or WebClient object.

                          --- single minded; short sighted; long gone;

                          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