你好。我需要在一个斜杠中替换双斜杠。我计划在 Global.asax Application_BeginRequest 事件中执行此操作。够了吗?或者更好地做一个http模块?谢谢你。
UPD
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo(AppSettings.UsedCulture)
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture
Dim retUrl As String
....
some code
....
'Dim app As HttpApplication = CType(sender, HttpApplication)
'app.Context.RewritePath(retUrl)
Dim myContext As HttpContext = HttpContext.Current
'Rewrite the internal path
myContext.RewritePath(retUrl)
End If
我正在使用.Net 1.1。而且它必须在.Net 1.1 RewritePath 不会重写 URL。为什么?
UPD2 决定在 Sub Application_BeginRequest 中使用新的重写 url 进行附加重定向。