返回urls跳转后的页面地址

       string urls = "http://xxx.xxx.com/SoftDown.aspx?SoftID=275781&fdid=119418725f1d4e20";
        // Response.Redirect(urls);

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urls);
        req.Method = "HEAD";
        req.AllowAutoRedirect = false;
        HttpWebResponse myResp = (HttpWebResponse)req.GetResponse();
        if (myResp.StatusCode == HttpStatusCode.Redirect)
        {
            Response.Write("redirected to:" + myResp.GetResponseHeader("Location"));
        }

返回urls跳转后的页面地址

你可能感兴趣的:(Net小技巧,string)