1

I am Redirecting my Action to another urls woth optional parameter and passing variable to the controller

RedirectToAction("action", new { a, c, s,ds});
but my urls loosk like this 
http://localhost:8080/contoller/action?a=1&c=2&s=3&ds=4
but when i directly call teh action the url looks like this 
http://localhost:8080/contoller/action/1/2/3/4
how can i get the same url with redirect ..any suggestion 
asked May 14, 2013 at 21:22
0

1 Answer 1

0

Have you try this? (I'm not sure if it works)

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

A dirty method is:

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

In fact I use the second one quite often, because it's clearer to see all the parameters and values. The only shortage is that if there is any error in the url, there is no warnings.

answered Aug 28, 2013 at 10:16
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.