C# 代码
string MyLink = “http://www.zei8.net/plus/download.php?open=2&id=55507&uhash=dc74d5c3ccbb8856f2e13515”;
HttpWebRequest “request = (HttpWebRequest)WebRequest.Create(MyLink);
rettpWebRequest)WebRequest.Create(MyLink);quest.Method = "GET";
request.Headers.Clear();
request.ContentType = "application/x-www-form-urlencoded";
request.KeepAlive = true;
request.AllowAutoRedirect = true;
HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse();
string mydownurl = httpResponse.ResponseUri.ToString();
httpResponse.Close();
服务器端的情况无法控制,我们无法更改服务器端代码。
MyLink 为原始的地址
形式为 http://www.*******.com/plus/download.php?open=2&id=55507&uhash=dc74d5c3ccbb8856f2e13515
我通过以上代码 获取mydownurl得到真实地址,但是当真实地址中存在中文的时候 获取的地址显示为乱码 是这样的地址
http:///www.*******.com/2015/201502/Äê14-20ÈÕ½ðÈÚ°²È«ÔËÐп¼ºËÇé¿öͨ±¨.rar
实际地址是
http:///www.*******.com/2015/201502/《原来康熙》全集.rar
找了个测试地址
http://www.zei8.net/plus/download.php?open=2&id=55507&uhash=dc74d5c3ccbb8856f2e13515