现在的位置: 首页 > 综合 > 正文

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

2013年01月22日 ⁄ 综合 ⁄ 共 579字 ⁄ 字号 评论关闭

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();
        }

抱歉!评论已关闭.