Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

On calling get method in ASP.NET core MVC6, it call post method also

$
0
0
I am using ASP.Net Core and MVC6 for development.I have an anchor tag with parameter in href where I am editing the form and redirecting it to another page but after get method getting call it calls post method also.It should not happen but why it's happening, it makes no scene to call its get method and post method if I have same method name but have different parameter like below.

[HttpGet]
public IActionResult EditTemplate(int Id)
{
return RedirectToRoute("","");
}
[HttpPost]
pblic IActionResult EditTemplate(Template model)
{
//to prevent post here I am checking model value which is not used by parameter in get method
if(!string.IsNullOrEmpty(model.TemplateName))
{
return View(model);
}
}

What's the issue?. If anyone have any idea about please share your thought.

Thanks.

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>