asp.net mvc - MVC3 Razor URL.Action Parameter Value with forward slash. giving error -


its small question on mvc3 razor, have string id "a/b" when trying call details or delete method of controller. getting error system assuming "a/b" 2 parameters have pass in 1 string value parameters.

--edit

< href="@url.action("details", "search", new {id = "a/b"})">details </a> 

my controller/method search/details (string id)

and want send id = 'a/b' . .net assuming 2 parameters in url.

please suggest.

it appears forward slashes not automatically encoded, , reason because if encoded (%2f), time reach routing engine have been decoded forward slash. (search robj in this post phil haack (former manager on mvc team)).

however, .net mvc routing w/ url encoding problems poses same problem, , appears way solve insert encoded slash query string. this:

< href="@url.action("details", "search")?id=@url.encode("a/b")">details </a> 

and then, dealing in method accessing:

request["id"] 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -