手机
当前位置:查字典教程网 >编程开发 >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下定制日期输出格式的代码

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

asp.net 无限分类第1/3页

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

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

asp.net如何在图片上加水印文字具体实现

asp.net实现C#绘制太极图的方法

asp.net(c#) ubb处理类

asp.net创建位图生成验证图片类

精品推荐
分类导航