Я использую ASP.Net MVC 5 и хочу передать данные из контроллера в представление БЕЗ добавления его в URL.
Я пробовал это так:
public ActionResult Index(LoginViewModel loginViewModel)
{
var landingPgVm = new LandingPgViewModel();
landingPgVm.ElectionName = loginViewModel.ElectionName;
landingPgVm.LandingPageTitle = loginViewModel.LandingPageTitle;
landingPgVm.LandingPageMessage = loginViewModel.LandingPageMessage;
return View("Landing", landingPgVm);
}
А это:
public ActionResult Index(LoginViewModel loginViewModel)
{
var landingPgVm = new LandingPgViewModel();
landingPgVm.ElectionName = loginViewModel.ElectionName;
landingPgVm.LandingPageTitle = loginViewModel.LandingPageTitle;
landingPgVm.LandingPageMessage = loginViewModel.LandingPageMessage;
ViewData["lpvm"] = landingPgVm;
return View("Landing");
}
И все же я получаю это:
http://localhost:nnnnn/Landing?VotingIsOpen=False&UserIp=%3A%3A1&BrowserAgent=Mozilla%2F5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F73.0.3683.103%20Safari%2F537.36&ElectionId=1&LoginId=********&LoginPin=*********&ElectionName=2019%20Member-at-Large%20Board%20Election&LandingPageTitle=Success%21&LandingPageMessage=Landing%20Page%20MESSAGE