views:

150

answers:

1

Hi - i'm looking at some pages, and i've noticed that by default for ID in the routing for controller/action/ID is an integer and not a string.

How can I change it so it is a string?

+3  A: 

Purely by creating an action like this:

Public Function MyAction(ByVal id as String) as ActionResult

The framework converts the url MyController/MyAction/SomeId for you. Normally it would convert the last section into an integer as that is how your method is defined, there's nothing to stop you from saying that it is a string and so no conversion is needed.

Garry Shutler