Step 1: Create a class and integrate it with the iroutehandler to implement the methods in the interface.
Step 2: Register route in application_start
Step 3: Configure web. config:
1. Add
<Httpmodules>
<Add Name="Urlroutingmodule" Type="System. Web. Routing. urlroutingmodule, system. Web, version = 4.0.0.0, culture = neutral, publickeytoken = b03f5f7f11d50a3a" />
</Httpmodules>
To support iis7
2. in <system. webserver>, add
<Modules Runallmanagedmodulesforallrequests="True">
<Remove Name="Urlroutingmodule"/>
<Add Name="Urlroutingmodule" Type="System. Web. Routing. urlroutingmodule, system. Web, version = 4.0.0.0, culture = neutral, publickeytoken = b03f5f7f11d50a3a" />
</Modules>
<Handlers>
Add name = "urlroutinghandler" precondition = "integratedmode" verb = " * " path = "urlrouting. axd " type = "system. web. httpforbiddenhandler, system. web, version = 2.0.0.0, culture = neutral, publickeytoken = b03f5f7f11d50a3a " />
</Handlers>
Or
1.System. Web-> httpmodules->
<Add
Name = "urlroutingmodule"
Type = "system. Web. Routing. urlroutingmodule, system. Web. Routing,
Version = 3.5.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35 "/>
2.System. webserver-> modules->
<Add
Name = "urlroutingmodule" type = "system. Web. Routing. urlroutingmodule, system. Web. Routing, version = 3.5.0.0,
Culture = neutral, publickeytoken = 31bf3856ad364e35 "/>
3.System. webserver-> handlers->
<Add
Name = "myroutinghandler"
Verb = "*"
Path = "urlrouting. axd"
Type = "XXX. myroutinghandler"/>
If sesstion cannot be used
Reference http://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests