手机
当前位置:查字典教程网 >编程开发 >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#)判断远程图片是否存在】相关文章:

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

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

asp.net显示页面执行时间

asp.net 上传大文件解决方案

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

asp.net图片上传实例

asp.net 购物车实现详细代码

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

asp.net webservice返回json的方法

c# .net 生成图片验证码的代码

精品推荐
分类导航