同一个网站空间,不同域名跳转到不同的路径

来源:互联网 发布:聊城职业技术学院网络 编辑:程序博客网 时间:2024/06/09 15:34


protected void Page_Load(object sender, EventArgs e)

        {
            string url, host_url, no_http;
            url = HttpContext.Current.Request.Url.ToString();
            no_http = url.Substring(url.IndexOf("//") + 2);                     // '截取去掉HTTP://的URL
            host_url = no_http.Substring(0, no_http.IndexOf("/")).ToLower();
            switch (host_url)
            {
                case "it.domain.com":
                    Response.Redirect("FolderIT/default.aspx");
                    break;
                case "clothes.domain.com":
                    Response.Redirect("FolderYF/default.aspx");
                    break;
            }


            Server.Transfer(host_url);
            //Response.Write();
        }
原创粉丝点击