This project is read-only.

Controller parameter containing # character

Topics: ASP.NET Web API
Oct 2, 2012 at 1:54 PM
Edited Oct 3, 2012 at 6:35 AM

I have a controller with a method that takes two parameters:

public HttpResponseMessage Put(string name, string id = null)

Route template is: "{controller}/{*name}"

Is there any way to retrieve in a controller method a string parameter if it contains '#' character in the middle? For example the following request url:

PUT http://localhost/mycontroller/namewith%23character?id=1a

causes that parameters of my Put method are: name == "namewith", id == null

The rest of the url I can find under:

Request.RequestUri.Fragment which is "#character?id=1a"