WebException 异常的 message

shoujiao 2016-11-16 09:33:22
WebException能捕获哪些异常,异常的message具体是什么,在msdn没有查到具体的异常信息,特来请教。
...全文
237 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
小枪 2016-11-16
  • 打赏
  • 举报
回复
WebException 可以转成string catch (Exception ex) { if (!string.IsNullOrEmpty(ex.Message) && ex.Message.Contains("404")) { WebException ex1 = (WebException)ex; HttpWebResponse response = (HttpWebResponse)ex1.Response; StreamReader sr = new StreamReader(Helper.GetStreamForResponse(response, Constants.TIME_OUT), Encoding.GetEncoding("utf-8")); string result = sr.ReadToEnd(); sr.Close();

110,530

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧