First, add two methods to the Global.asax file
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}")
RouteTable.Routes.Ignore("{resource}.ashx/{*pathInfo}")
RegisterRoutes(RouteTable.Routes)
End Sub
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.MapPageRoute("",
"Ministries/{ministryName}",
"~/ministries.aspx",
True,
New RouteValueDictionary(New With {.ministryName = "ministriesHome"}))
End Sub
and in the target page (in this case 'Ministries.aspx')
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strMinistry = Convert.ToString(Page.RouteData.Values("ministryName"))
End Sub
First, we register a route for "Ministries/{ministryName}" and we send it to "~/ministries.aspx". We also tell the route that if no 'ministryName' is provided, the default will be "ministriesHome"
Next we retrieve the variable in the target page.
That's all there is to it.