ASP.NET 路由。如何在通用处理程序中使用路由?
我尝试在以下通用处理程序中使用 ASP.Net,但在 Page.RouteData
处收到此错误
Reference to a non-shared member requires an object reference
我做错了什么?
<%@ 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
对于任何答案,请记住我是一个新手,我的语言是 VB.NET :) 先感谢您。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请尝试以下操作。您必须检索路由表并从中读取。
查看此链接和msdn 了解有关路由的更多详细信息。
Try the following.You have to retrieve the route table and read from it.
Take a look at this link and msdn for more details on routing.