How can I pass a viewmodel to a view without the model’s data showing up in the URL?
public ActionResult MyView(MyModel model)
{
model.memberId = "Secret Id"
return View("MyView", model)
}
URL shows up as
http://localhost:1234/MyView?memberId=Secret Id
The data is not critically secret but having it show up in the URL is not really acceptable.
I don’t know what you are up to, you should never set anything secret in a viewmodel – because the viewmodel is as the name says to be seen…
But to answer your question: To avoid the memberId occuring in the url you can submit your form by post – but that is of course not secure as well.
You should better store that in the session for example.