I created a Web API project in Visual Studio. I am using attribute routing. Here is the controller under Controllers folder:
public class RegistrationController : Controller
{
// GET: Registration
[Route("")]
public ActionResult CreateUser(string platform)
{
return View("~/Views/Registration/CreateUser.cshtml", platform);
}
}
When I call the CreateUser action by the URL http://localhost/application it works but when I try to pass a query string parameter by the URL http://localhost/application?platform=android, it gives the following error:
The view '~/Views/Registration/CreateUser.cshtml' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Registration/CreateUser.cshtml
~/Views/Registration/android.master
~/Views/Shared/android.master
~/Views/Registration/android.cshtml
~/Views/Registration/android.vbhtml
~/Views/Shared/android.cshtml
~/Views/Shared/android.vbhtml
I cannot understand why it cannot find the view when it is there or why it even tries to find a view with the name of the query string parameter.