private string url;
// Use this for initialization
void Start () {
HttpWebRequest myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create("这里填写Url");
myHttpWebRequest.AllowAutoRedirect = false;
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
url = myHttpWebResponse.Headers.Get("Location");
}
一般运用于网络运营商重定向地址。
万恶的网络运营商。

本文介绍了一种使用C#通过HttpWebRequest和HttpWebResponse获取网络运营商重定向地址的方法。该方法禁用了自动重定向功能,从而能够捕获到重定向的目标URL。
1057

被折叠的 条评论
为什么被折叠?



