When to use HttpGet and HttpPost method with ActionResult method in ASP.Net MVC?
When to use HttpGet and HttpPost method with ActionResult method in ASP.Net MVC?
122015-Mar-2022
Updated on 15-Mar-2022
Home / DeveloperSection / Forums / When to use HttpGet and HttpPost method with ActionResult method in ASP.Net MVC?
When to use HttpGet and HttpPost method with ActionResult method in ASP.Net MVC?
Ana ka
08-Sep-2022HttpGet and HttpPost are both the methods of posting client data or form data to the server. HTTP is a HyperText Transfer Protocol that is designed to send and receive the data between client and server using web pages.
Kalin
15-Mar-2022HttpGet in ASP.Net MVC:
HttpGet method send data to the server using query string. The data which send is visible to URL and it can visible for all the users. It is not secure than HttpPost but it is fast and quick than that. Generally this is used when you are not posting sensitive data to the server like user’s name and password or other personal important information.
By default HttpGet is used with ActionResult method in controller page in asp.net mvc.
Features :
1- It is fast and quick response.
2- It is default method in asp.net mvc.
3- URLs that are created using it, easily readable.
4- Its used suitable when not posting any sensitive data to the server.
Exp- HttpGet is used with ActionResult() in controller like below-
HttpPost in ASP.Net MVC:
HttpPost methods hides user’s information from URL when post data to the server and does not bind data to URL. It is secure than HttpGet method but it is slower than that. When sending any sensitive data to the server then it is used.
Features:
1- It is slower than HttpGet method.
2- It is used when sensitive data post on server.
3- It is hide information from the URL.
4- It carry both binary and text data.
5- It is more secure than HttpGet method.
Exp-