usermappath.vb

来自「This is a book about vb.you could learn 」· VB 代码 · 共 38 行

VB
38
字号
Imports System
Imports System.Web

Public Class UserMapPath
		Implements IHttpModule

  Public ReadOnly Property ModuleName() As String
    Get
      Return "UserMapPath"
    End Get
  End Property

  Public Sub Init(app As HttpApplication) Implements IHttpModule.Init
    AddHandler app.BeginRequest, AddressOf App_BeginRequest
  End Sub

  Public Sub App_BeginRequest(sender As Object, e As EventArgs)
  
    Dim application As HttpApplication = CType(sender, HttpApplication)
    Dim context As HttpContext = application.Context
    Dim Request As HttpRequest = context.Request

    Dim path As String = Request.Path
    Dim index As Integer = path.IndexOf("~")
    
    If index > 0 Then
      Dim newPath As String = path.Substring(0, (index - 1))
      Dim name As String = path.Substring(index)
      context.Response.Write(newPath & " : " & name)
      
    End If
  
  End Sub

  Public Sub Dispose() Implements IHttpModule.Dispose
  End Sub

End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?