tags:

views:

21

answers:

1

I have the problem that I must map a fixed URL parameter that contains an underline (e.g. purchase_id) to an controller.

    public ActionResult Index(
        long purchase_Id, 

That is working, and it's not my problem. The thing that annoys me, is the underline in the parameter name, due to the fact, that I can't change the given URL Parameter. It's called purchase_id

e.g. http://www.example.com/Order?purchase_id=12123

Is there any chance to get the following thing working, without changing the URL parameter?

    public ActionResult Index(
        long purchaseId, 

Thanks for your help.

+1  A: 
public ActionResult Index()
{
    string purchaseId = Request["purchase_id"];
    return View();
}

or:

public ActionResult Index([Bind(Prefix="purchase_id")]string purchaseId)
{
    return View();
}
Darin Dimitrov
Hey, that's really cool. I like the seocond version. Thanks so much.
BitKFu