ASP.NET MVC: Setting Objects in ActionParameters Also Adds These to the Query String

I have a controller method that looks like this:

[AcceptGet]
public ActionResult Index(SecurityMatrixIndexViewModel model)
{
    if (model == null)  
        model = CreateIndexViewModel();

    return View(model);
}

      

In another controller method, I redirect the index action to this. I have an action filter attribute that takes a model object from TempData and assigns it to filterContext.ActionParameters ["model"], which will pass that object to Index () as a "model" parameter. The problem is when I add the object to the ActionParameters it also puts "? Model = MyProject.SecurityMatrixIndexViewModel" in the URL as a query string. Do you know how I can set something to ActionParameters without becoming part of the query string?

John

0


a source to share


1 answer


I don't think this is possible during a GET - since the request data is passed through the querystring.



+1


a source







All Articles