复制代码 代码如下:
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;
}
}
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;
}
}
标签:
c#,远程图片
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“asp.net(c#)判断远程图片是否存在”评论...