I have working with ASP.NET MVC for 8 months give or take. I know basic routing and how it works but I have few questions in my mind.
First , I have to explain what I know , right? So for instance in the below routing I know the pattern and how it works.
routes.MapRoute(
"Categories",
"category/{CategoryName}",
/*If I use 'mysite.com/category/anything'
it will look into the 'News' controller and
then Category action with the given
parameter('anything') in the category
action's with the same name parameter.
EG. public ActionResult Category(Anytype CategoryName) { ... }
*/
new { controller = "News", action = "Category", CategoryName = "" },
new string[] { "MyProj.Controllers" } //it is for specifying specific
//Namespace, mostly used for distinguishing between area routing and regular routing
);
Now if in the above example I had method like
public ActionResult Category(Anytype CategoryName2)
Above route won't work because param name does not match. However, if I submitted a FORM from the category action to the same name action like:
[HttpPOST]
public ActionResult Category(ModelType Anyname){...}
It works just fine. However, if I submit a FORM from another place does it work?
Another thing, when we use the [HttpGET] annotation it can receive any params , there is no restrictions , so why only restrictions on the non action-verb annotated actions? Can anyone please briefly explain this fact?
As an example , my this post can help what I mean. I had change the route at last to make it work.
Is it possible/right to use multiple @Html.AntiForgeryToken() in 2 different forms in one page?
Thank you all in advance.