0

I am using MVC2 in my application. I am passing a token in my url. When I call the controller it's working fine but I need to add one more parameters "Cid=x"

Code:

public ActionResult DetailPreferences(VMDetailPreferences vm)
{
    if (!string.IsNullOrEmpty(Request["token"]))
    {
        GetDetails(Request["token"]);
       return View(vm);
    }    
}

http://mydomain.com/Api/Al/DetailPreferences?token=12345 but i want to call http://mydomain.com/Api/Al/DetailPreferences?token=12345&Cid=x

Is it possible to add Cid=x ?

Justin
  • 26,443
  • 16
  • 111
  • 128
Northstar
  • 11
  • 2
  • 1
    You can easily add a route which handles the additional parameter. There is an excellent answer [here](http://stackoverflow.com/questions/2246481/routing-with-multiple-parameters-using-asp-net-mvc) showing you exactly how to do that. – DOK May 30 '13 at 19:11

1 Answers1

0

At that point it's too late to add it to the url because the url is already being called.

You could redirect to the url and add on the token, but I don't think this is what you want

RedirectToAction("DetailPreferences", new {cid = "x"});

A better option to access the information on your view is to add it to the viewdata

ViewData["cid"] = "x";
Kyle
  • 1,172
  • 1
  • 8
  • 23
  • Thanks for your reply, but my case it doesn't work i am passing only one parameter "token",here i am not looking for access that parameter when i pass "token" page load i need go with both parameters in url ... – Northstar May 30 '13 at 19:19