Uri uri = new Uri("http://......../画皮.mpeg"); client.DownloadFile(uri,Application.StartupPath + "/画皮.mpeg");
using System.Net; WebClient client = new WebClient(); Uri uri = new Uri("http://......../画皮.mpeg"); client.DownloadFile(uri,Application.StartupPath + "/画皮.mpeg");
str1 = Server.UrlEncode(Server.UrlEncode("下载的名称"))
Response.Write(HttpUtility.UrlDeCode(Request["str1"],Encoding.GetEncoding("gb2312"));
WebClient(str,path);
你引用System.web ,然后 str1 = Server.UrlEncode(Server.UrlEncode("下载的名称"))
Response.Write(HttpUtility.UrlDeCode(Request["str1"],Encoding.GetEncoding("gb2312"));
Server.URLDecode("")
这些人真是的,cs结构下还老要别人用Server.UrlEncode。
Utitlity嘛,不就是工具的意思?
{
int length = s.Length;
UrlDecoder decoder = new UrlDecoder(length, e);
for (int i = 0; i < length; i++)
{
char ch = s[i];
if (ch == '+')
{
ch = ' ';
}
else if ((ch == '%') && (i < (length - 2)))
{
if ((s[i + 1] == 'u') && (i < (length - 5)))
{
int num3 = HexToInt(s[i + 2]);
int num4 = HexToInt(s[i + 3]);
int num5 = HexToInt(s[i + 4]);
int num6 = HexToInt(s[i + 5]);
if (((num3 < 0) || (num4 < 0)) || ((num5 < 0) || (num6 < 0)))
{
goto Label_0106;
}
ch = (char) ((((num3 << 12) | (num4 << 8)) | (num5 << 4)) | num6);
i += 5;
decoder.AddChar(ch);
continue;
}
int num7 = HexToInt(s[i + 1]);
int num8 = HexToInt(s[i + 2]);
if ((num7 >= 0) && (num8 >= 0))
{
byte b = (byte) ((num7 << 4) | num8);
i += 2;
decoder.AddByte(b);
continue;
}
}
Label_0106:
if ((ch & 0xff80) == 0)
{
decoder.AddByte((byte) ch);
}
else
{
decoder.AddChar(ch);
}
}
return decoder.GetString();
}这是HttpUtility.UrlEncode(url)最后调用的方法的源代码,呵呵
就是一个对字符串串的处理而已
Uri uri = new Uri("http://......../画皮.mpeg");
client.DownloadFile(uri,Application.StartupPath + "/画皮.mpeg");
WebClient client = new WebClient();
Uri uri = new Uri("http://......../画皮.mpeg");
client.DownloadFile(uri,Application.StartupPath + "/画皮.mpeg");