手机
当前位置:查字典教程网 >编程开发 >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(c#) 水仙花数

asp.net(c#) MS AJAX的安装

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

asp.net(c#)有关 Session 操作的几个误区

asp.net DZ论坛中根据IP地址取得所在地的代码

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

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

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

精品推荐
分类导航