如何抑制 HTTPWebRequest 期间出现的安全风险通知
当我向某些网站发送 HTTPWebRequest 时,我收到一条弹出消息,指出该网站存在指定的安全风险,我是否要继续。直到 HTTPWebRequest 被检索并存储为字符串(下面代码中的 ResponseAsString)之后,该消息才会出现。 HTTPWebrequest 检索网页文本,随后使用以下代码将其转换为 IHTMLDocument2。警告出现在命令上 - oDoc.close(); try-catch 块不会产生显示错误。有什么办法可以抑制这个消息吗?
//Creates IHTMLDocument2 frow WebRequest!
private IHTMLDocument2 GetIHTMLDoc2FromString(string ResponseAsString)
{
HTMLDocument ProfileHTML = new HTMLDocument();
IHTMLDocument2 oDoc = (IHTMLDocument2)ProfileHTML;
oDoc.write(ResponseAsString);
oDoc.close();
return oDoc;
}
When I send HTTPWebRequests to certain web sites I get a popup message stating that there us an upspecified Security Risk associated with the site and do I want to continue. The message does not occur until after the HTTPWebRequest has been retrived and stored as a string (ResponseAsString in the code below). The HTTPWebrequest retrieves the text of a webpage which is subsequently converted into an IHTMLDocument2 with the code that follows. The warning occurs on the command -- oDoc.close(); A try-catch block does not yield show an error. Is there any way to suppress this message?
//Creates IHTMLDocument2 frow WebRequest!
private IHTMLDocument2 GetIHTMLDoc2FromString(string ResponseAsString)
{
HTMLDocument ProfileHTML = new HTMLDocument();
IHTMLDocument2 oDoc = (IHTMLDocument2)ProfileHTML;
oDoc.write(ResponseAsString);
oDoc.close();
return oDoc;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用此代码
然后在您的 httprequest 上使用
use this code
Then on your httprequest use