Helper Helper - 1 year ago 77
ASP.NET (C#) Question

Get and Post vs Query String

Whenever we redirect from one page to another page, Query string can be used. Now when i used the "GET" and "POST" methods in the form tag.

I have got the following findings.

  1. Get - Exposes is the data of password fields in the URL. SO it should not be used. Right?

  2. POST - Some unnecessary data can be accessed from Request .Form of the textbox fields which is not required.

I think, while navigating to another page, I can use Query String on clikcing the button like below.

Response.Redirect("abc.aspx?id=10") //This will be at the code behind level.

and similarly we can use in Java Script like below.

function RedirecToAnotherPage(){'abc.aspx?id=10');}


Here, my query is in which case, I can use the "GET" and "Post" method in real life/dynamic website

Answer Source

POST removes constraints that GET has, like maximum query string size. You can control what data is sent by controlling which fields are inside the form tag. You can have multiple form tags and post the relevant one.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download