James Ray Anderson

James Ray Anderson
James Ray Anderson
0 comments

MVC - Sample RedirectToRoute

9:45 PM
Here is a sample RedirectToRoute() with QueryString options.
 
My Goal:
http://localhost:<port>/<controller>/<action>/<id>?task=<value>&status=<value>
 
Example RedirectToRoute Call:
 
...{some other code before this}...
 
int itemId = 123;
 
return RedirectToRoute(
     "Default"
     new { controller = "MyController"
            action = "Index"
            id = itemId, 
            task="add"
            status="1"
          }
);
 
 
Final Output:
http://localhost:50209/MyController/Index/123?task=add&status=1

0 comments:

 
Toggle Footer
Top