WebBrowser控件重定向问题

时间:2011-07-20 08:55:21

标签: c# redirect browser

我在我的应用程序后台使用webbrowser控制台登录https网站并废弃一些信息。现在,当我在webbrowser中发送请求时,该站点的登录页面为我提供了一个移动的302站点。在ie / ff中,它会自动登录而不显示重定向消息。但是当我在webbrowser中发送相同的请求时,它不会自动重定向。它有什么问题吗?

源:

private void Login ()
{
 string PostDataStr = "UserId=testid&password=12345&target=https%3A%2F%2Fwww22.verizon.com%2Fsso%2Fredirect%2Fredirect.asp%3FTarget%3D%24SM%24http%3A%2F%2Fwww22.verizon.com%2Fwholesale%2Fsecure%2Faccess%2Fsystems%2Fhome.jsp&submit.x=15&submit.y=9";

  byte[] PostDataByte = Encoding.UTF8.GetBytes(PostDataStr);
  string AdditionalHeaders = "Content-Type: application/x-www-form-urlencoded" + Environment.NewLine;


  string AdditionalHeaders =
        @"https://www22.verizon.com/wholesale/secure/sso/ws_login/?TYPE=335&REALMOID=06-3e9d7b25-1122-001f-0000-1aa805434aa8&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=tq1AzbdwdMdEst0ALQcyYmIHjgOgggTdkxlGiXET7va&TARGET=$SM$http%3a%2f%2fwww22%2everizon%2ecom%2fwholesale%2fsecure%2faccess%2fsystems%2fhome%2ejsp" +
        Environment.NewLine;

 webBrowser1.ScriptErrorsSuppressed = true;
 webBrowser1.Navigate("https://www22.verizon.com/wholesale/secure/access/systems/home.jsp", "", PostDataByte, AdditionalHeaders);            
}

基本上这是网站: http://www22.verizon.com/wholesale/access/ordering

以下是登录的发生方式

 [20:59:05.527] POST https://www22.verizon.com/sso/common/login.fcc [HTTP/1.0 302 Moved Temporarily 791ms]

 [20:59:06.344] GET https://www22.verizon.com/sso/redirect/redirect.asp?Target=$SM$http://www22.verizon.com/wholesale/secure/access/systems/home.jsp [HTTP/1.0 302 Moved Temporarily 4884ms]

[20:59:11.233] GET https://www22.verizon.com/wholesale/secure/access/systems/home.jsp [HTTP/1.1 200 OK 7321ms]

0 个答案:

没有答案