In the application I am working on, I have an Html page inside views folder and I have mentioned the action as follows.
<form name="form" onsubmit="return validateForm();" method="post" action="//Controllers/RegistrationController.cs">
The registration controller returns a view.
public ActionResult Detail(string name)
{
return View();
}
When I run the program, I get server not found error.
I also tried changing the action string to action="//Controllers/RegistrationController.cs/Detail"
but got the same error.
Does the action string have to be written in some other way?
Thank you very much in advance for your help.
Description
You don’t have to set the path like in your solution. You don’t need to set
Controllersbecause the framework knows that you mean the controller.Assuming that you dont change the routing in
global.asax, yourRegistrationController.cshas an ActionMethod calledDetail(decorated with[HttpPost]) and the following folder structure within your project.Views/Registration/Detail.cshtml