1

你好。我需要在一个斜杠中替换双斜杠。我计划在 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 进行附加重定向。

4

1 回答 1

0

如果您使用的是 IIS 7.0(和更高版本),则可以使用IIS UrlRewrite 模块。我们已经使用了一段时间,没有任何抱怨。

于 2010-10-19T14:38:20.100 回答