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.
- Get - Exposes is the data of password fields in the URL. SO it should not be used. Right?
- 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(){
window.open('abc.aspx?id=10');}
Right?
Here, my query is in which case, I can use the "GET" and "Post" method in real life/dynamic website
You have to choose GET method especially when you want to read and choose
POST
when you want to write/update (database or file etc). Take a look at article - Methods GET and POST in HTML forms - what's the difference?To learn more on ASP.NET web-app Forms.
POST
removes constraints thatGET
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.