How can I add parametr to link in MVC? When I use this (in controller) below code
Model model = GetModel();
string lang = "pl";
string viewName = "MyPage";
return View(viewName + "?lang=" + lang, model);
I get error
The view ‘MyPage?lang=pl‘ or its master was not found or no view engine supports the searched locations. The following locations were searched: …
When you retun
Viewresult ASP.NET MVC simply renders this view for you. It has nothing to url. Url is entered by the user into browser to call your MVC action. If you whant to change the url you should userRedirectToActionresult. E.g: