我制作HttpWebRequest / HttpWebResponse,当我收到回复时,我收到错误 - >
此网站的加载项无法运行。单击Internet选项中的安全设置以查找潜在冲突。
我无法在网站上按下允许popUps,我需要对此进行编程,启用popUp或将注册表项添加到此网站。
这是我的代码
string postData += "userid=" + strUser + "&";
postData += "numID=" + strUserId + "&";
postData += "userPassword=" + strPass + "&";
HttpWebRequest postRequest = (HttpWebRequest)WebRequest.Create(loginPostUrl);
postRequest.CookieContainer = new CookieContainer();
postRequest.CookieContainer = _cookies;
postRequest.Method = WebRequestMethods.Http.Post;
postRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0";
postRequest.AllowWriteStreamBuffering = true;
postRequest.ProtocolVersion = HttpVersion.Version11;
postRequest.AllowAutoRedirect = true;
postRequest.ContentType = "application/x-www-form-urlencoded";
byte[] byteArray = Encoding.ASCII.GetBytes(postData);
postRequest.ContentLength = byteArray.Length;
Stream newStream = postRequest.GetRequestStream(); //open connection
newStream.Write(byteArray, 0, byteArray.Length); // Send the data.
newStream.Close();
HttpWebResponse postResponseAfterLogin = (HttpWebResponse)postRequest.GetResponse();
//After inserting User and Password
Stream streamResponseLoginForm = postResponseAfterLogin.GetResponseStream();
StreamReader streamReadLoginForm = new StreamReader(streamResponseLoginForm);
outString = streamReadLoginForm.ReadToEnd();//This is afer login btn pressed here we
我尝试使用WatIn登录
使用(var browser = new IE(" www.blabla.com")) {
browser.TextField(Find.ById("userID")).Value = strUser;
browser.TextField(Find.ById("numID")).Value = strUserId;
browser.TextField(Find.ById("userPassword")).Value = strPass;
browser.Image(Find.ById("inputSend")).Click();
Thread.Sleep(WaitTime+2000);
}
这不起作用。我看到这个popUp IE不允许popUp来自网站www.blabla.com"
如何允许从网站或我的网站www.blabla.com弹出窗口"允许弹出窗口的网站列表?
答案 0 :(得分:0)
你必须去网络选项 - >隐私 - >并取消选中启用POPUP并保存。
当您的Activex控件已安装时,您必须仅通过此方法允许它们。