欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net(c#)判斷遠(yuǎn)程圖片是否存在

 更新時間:2008年09月19日 23:46:43   作者:  
不錯的應(yīng)用,大家可以拓展到,判斷遠(yuǎn)程文件是否存在等功能
復(fù)制代碼 代碼如下:

private int GetUrlError(string curl)
{
int num = 200;
if(this.method==1)
{
HttpWebRequest request=(HttpWebRequest) WebRequest.Create(new Uri(curl));
ServicePointManager.Expect100Continue=false;
try
{
((HttpWebResponse)request.GetResponse()).Close();
}
catch(WebException exception)
{
if(exception.Status != WebExceptionStatus.ProtocolError)
{
return num;
}
if(exception.Message.IndexOf( "500 ")>0)
{
return 500;
}
if(exception.Message.IndexOf( "401 ")>0)
{
return 401;
}
if(exception.Message.IndexOf("404")>0)
{
num=404;
}
}
return num;
}
}

相關(guān)文章

最新評論