HttpWebResponse returns 404 error(解决异常后读取后续数据的问题)

Hi, How to let Httpwebresponse ignore the 404 error and continue with it? It's easier than looking for exceptions in input as it is very rare when this happens.

try

   
{
       
HttpWebRequest request = ( HttpWebRequest ) HttpWebRequest . Create ( "http://mysite.com" );
       
HttpWebResponse response = ( HttpWebResponse ) request . GetResponse ();          
   
}
   
catch ( WebException ex )
   
{
       
HttpWebResponse webResponse = ( HttpWebResponse ) ex . Response ;          
       
if ( webResponse . StatusCode == HttpStatusCode . NotFound )
       
{
           
//Handle 404 Error...
       
}
   
}

from:http://stackoverflow.com/questions/1857512/httpwebresponse-returns-404-error
阅读更多
文章标签: input
个人分类: .net
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

HttpWebResponse returns 404 error(解决异常后读取后续数据的问题)

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭