title: Passing querystring Ids URL Routing using namespace system.web.Routing
body: <p>I'm new to URL routing.</p>
  
  <p>Case 1: I can implement URL Routing for <code>URL:/content/category.aspx</code> mapped to <code>/Reservation</code></p>
  
  <p>Case 2: I'm not quite sure how to handle the query string values.</p>
  
  <p>For example:</p>
  
  <pre><code>URL:/content/category.aspx?SID=5&amp;CID=191
  </code></pre>
  
  <p>I want this to map to: <code>/Reservation</code></p>
  
  <p>Code written for Case 1:</p>
  
  <p><strong>Global.asa</strong></p>
  
  <pre><code>Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
      RegisterRoutes(RouteTable.Routes)
  End Sub
  
  Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
      Dim urlPattern As String
      Dim Reservation As Route
      urlPattern = "Reservation/"
      Reservation = New Route(urlPattern, New JRouteHandler("~/content/category.aspx"))
      RouteTable.Routes.Add("Reservation", New Route("Reservation", New JRouteHandler     ("~/content/category.aspx")))
  End Sub
  </code></pre>
  
  <p><strong>Http Handler</strong></p>
  
  <pre><code>Public Sub New(ByVal virtualPath As String)
      _virtualPath = virtualPath
  End Sub
  
  Public Function GetHttpHandler(ByVal requestContext As RequestContext) As IHttpHandler Implements IRouteHandler.GetHttpHandler
      If (Not UrlAuthorizationModule.CheckUrlAccessForPrincipal(_virtualPath, requestContext.HttpContext.User, requestContext.HttpContext.Request.HttpMethod)) Then
          requestContext.HttpContext.Response.StatusCode = CInt(Fix(HttpStatusCode.Unauthorized))
          requestContext.HttpContext.Response.End()
      End If
  
      Dim display = TryCast(BuildManager.CreateInstanceFromVirtualPath(_virtualPath, GetType(Page)), name)
  
      display.pageName = TryCast(requestContext.RouteData.Values("name"), String)
      Return display
  End Function
  </code></pre>
  
  <hr>
  
  <pre><code>Public Interface name
      Inherits IHttpHandler
      Property pageName() As String
  
  End Interface
  </code></pre>
  
  <p>-In web config
   </p>
  
  <p>
        
        </p>
  
  <p>
      
      
        
             </p>
  
  <pre><code>&lt;/modules&gt;
  </code></pre>
  
  <p>
        
       
    </p>