手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net(c#)判断远程图片是否存在
asp.net(c#)判断远程图片是否存在
摘要:复制代码代码如下:privateintGetUrlError(stringcurl){intnum=200;if(this.method==...

复制代码 代码如下:

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;

}

}

【asp.net(c#)判断远程图片是否存在】相关文章:

asp.net图片上传实例

asp.net(c#)中取得文件物理路径

asp.net(c#)利用构造器链的代码

asp.net(c#) RSS功能实现代码

ASP.net(c#)打造24小时天气预报及实时天气

C# 判断两张图片是否一致的快速方法

Asp.net清空cache禁用页面缓存的方法

asp.net(C#)生成Code39条形码实例

用存储过程向数据库存值的具体实现

asp.net(c#) ubb处理类

精品推荐
分类导航