ASP.NET 判斷來源頁面的幾個方法
有時候要依照來源頁面做處理,例如轉址, 有以下幾個方法 方法一: dim strRef as string = Request.ServerVariables("HTTP_REFERER") select case strRef case "http://www.123.net" Response.Redirect "/~abc/Index.asp" case "http://www.789.net" Response.Redirect "/~cde/Index.asp" case else Response.Write "你是偷渡客吼!" end select 方法二: dim a as string =string.empty If Not Request.UrlReferrer Is Nothing Then a=System.IO.Path.GetFileName(Request.UrlReferrer.AbsolutePath) select case a case "1.aspx"" case "2.aspx" ..... end select end if