如何根据aspx页面中的主机重定向用户? 例如,如果url为host22.com,我希望将用户重定向到localhost99.com;如果url为localhost99.com,我希望将用户重定向到host22.com
protected void Page_Load(object sender, EventArgs e) { if (Request.ServerVariables["SCRIPT_NAME"] + "?" + Request.ServerVariables["QUERY_STRING"] != "host22.com/default.aspx") { Response.Redirect("http://localhost99.com/"); } }
请帮忙。谢谢
在请求处理管道的上游这样做可能会更成功。检查在应用程序中插入http处理程序模块的可能性。