Search code examples
asp.netvb.netashxasp.net-routinggeneric-handler

ASP.NET Routing. How can i use Routing in a Generic Handler?


I tried to use ASP.Net's in the following generic handler, but i get this error at Page.RouteData

Reference to a non-shared member requires an object reference

What i am doing wrong?

<%@ WebHandler Language="VB" Class="MainHandler" %>

Imports System
Imports System.Web
Imports System.Xml


    Public Class MainHandler : Implements IHttpHandler, System.Web.SessionState.IRequiresSessionState

        Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

            Dim lng As String = Page.RouteData.Values("locale")

        End Sub

        Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Get
                Return False
            End Get
        End Property

    End Class

For any answers, please keep in mind that i am a newbie, and my tongue language is VB.NET :) Thank you in advance.


Solution

  •  Dim lng As String = HttpContext.Current.Request.RequestContext.RouteData.Values("locale")