以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何只是替换端口跳转地址  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=180954)

--  作者:xluoping
--  发布时间:2022/10/20 9:43:00
--  如何只是替换端口跳转地址
当访问 www.bless.cn:80/index.html?act=new&sty=0 , 如何直接跳转 www.bless.cn:32178/index.html?act=new&sty=0
Select Case e.Host
    Case "www.bless.cn"
        If e.Port = 80 Then
            e.WriteString("<meta http-equiv=\'Refresh\' c>") \'那么直接跳转到登录页面
            Return
        End If
End Select

--  作者:有点蓝
--  发布时间:2022/10/20 9:55:00
--  
Select Case e.Host
    Case "www.bless.cn"
        If e.Port = 80 Then
            e.Redirect(e.Request.URL.ToString.replace(":80/",":32178/"))
            Return
        End If
End Select

--  作者:xluoping
--  发布时间:2022/10/20 10:19:00
--  
考虑到默认:80,代码优化了一下:
        If e.Port = 80 Then
            Dim ulst As String = e.Request.URL.ToString
            If ulst.Contains(":80/") Then
                e.Redirect(ulst.replace(":80/",":32178/"))
            Else                
                e.Redirect(ulst.Insert(8 + ulst.SubString(8).IndexOf("/"),":32178"))
            End If
            Return
        End If