For example we want to edit a person and his URL is like
person/id
but what if the value of that ID is something like "/34555P3"
For example we want to edit a person and his URL is like
person/id
but what if the value of that ID is something like "/34555P3"
Then it should be URL-encoded:
person/%2F34555P3
Since the type of the id
in the routing/actions would clearly need to be a string
, it will automatically be URL-decoded by the framework when determining its value. In most cases the framework will automatically URL-encode it for you when you use it as a route value in things like Html.ActionLink()
or Url.Action()
. Anywhere that you use the value manually you may need to encode it manually.