How to pass special characters so ASP.NET MVC can handle correctly query string data?
- by labilbe
Hello,
I am using a route like this one:
routes.MapRoute("Invoice-New-NewCustomer",
"Invoice/New/Customer/New/{*name}",
new { controller = "Customer", action = "NewInvoice" },
new { name = @"[^\.]*" });
There is an action which handles this route:
public ActionResult NewInvoice(string name)
{
AddClientSideValidation();
CustomerViewData viewData = GetNewViewData();
viewData.InvoiceId = "0";
viewData.Customer.Name = name;
return View("New", viewData);
}
When I call return RedirectToAction("NewInvoice", "Customer", new {name}); and name is equal to "The C# Guy", the "name" parameter is truncated to "The C".
So my question is : What is the best way to handle this kind of special character with ASP.NET MVC?
Thanks!