asp.net mvc 3 - MVC URL RedirectToAction URl has variable and its parameter in Url -


i redirecting action urls woth optional parameter , passing variable controller

redirecttoaction("action", new { a, c, s,ds});  urls loosk   http://localhost:8080/contoller/action?a=1&c=2&s=3&ds=4  when directly call teh action url looks   http://localhost:8080/contoller/action/1/2/3/4  how can same url redirect ..any suggestion  

have try this? (i'm not sure if works)

    redirecttoaction("action", new { = a, c = c, s = s,ds = ds}); 

a dirty method is:

    redirect("/area/home/action?a=" + + "&b=" + b + "&c=" + c + "&ds=" + ds); 

in fact use second 1 quite often, because it's clearer see parameters , values. shortage if there error in url, there no warnings.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -