直接跟在URL后面发过去不行吗?

解决方案 »

  1.   

    但是用这种方式传递的数据能够看到,如果把地址栏里的地址复制再回车不就又可以顺利的进入到该页面里去了。所以程序要求不能用Get方式传递,只能用post方式而且加密传递。再请教。
      

  2.   

    strURL = Trim$(txtURL.Text) & "?name=" & Trim$(txtName.Text) & "&password=" & Trim$(txtPassword.Text)Call WBTest.Navigate2(strURL)
      

  3.   

    post方式提交数据
    Option ExplicitPrivate Sub Command1_Click()
        Dim szValue As String
        WebBrowser1.Document.body.innerHTML = "<form id=post method=post action=http://地址/xxx.php><input type=text value='" & szValue & "'></form>"
        WebBrowser1.Document.Forms("post").submit
    End SubPrivate Sub Form_Load()
        WebBrowser1.Navigate2 "about:blank"
    End Sub
      

  4.   

    请问:在WebBrwoser控件里提供的Navigate或者Navigate2方法中提供了传递数据的参数,调用方式为:WebBrowser1.Navigate2(URL,[Flags],[TargetFrameName],[PostData],[Headers])
    其中PostData参数就是一个提交参数字符串,例如"name=aaa&password=123",但问题是为什么这个方法并不是有效的,服务器端不能取得数据?
    如果这个方法是有效的话就不需要用一段html代码模拟这种调用了。
      

  5.   

    Navigate2 Method--------------------------------------------------------------------------------DescriptionNavigates to the resource identified by a Universal Resource Locator (URL) or to the file identified by a full path. The Navigate2 method extends the Navigate method to support browsing on special folders—such as Desktop and My Computer—that are represented by a pointer to an item identifier list (PIDL). However, this is not applicable to the Visual Basic programming language. For information on this functionality, see the Using the WebBrowser Control from C/C++ section. 
    Syntax
    object.Navigate2 URL [Flags,] [TargetFrameName,] [PostData,] [Headers]Part Description 
    object Required. An object expression that evaluates to an object in the Applies To list. 
    URL Required. A string expression that evaluates to the URL of the resource to display or the full path to the file location. 
    Flags Optional. A constant or value that specifies whether to add the resource to the history list, whether to read from or write to the cache, and whether to display the resource in a new window. It can be a combination of the following constants or values. Constant Value Meaning  
    navOpenInNewWindow 1 Open the resource or file in a new window. 
    navNoHistory 2 Do not add the resource or file to the history list. The new page replaces the current page in the list. 
    navNoReadFromCache 4 Do not read from the disk cache for this navigation. 
    navNoWriteToCache 8 Do not write the results of this navigation to the disk cache. 
     
    TargetFrameName Optional. String expression that evaluates to the name of an HTML frame in URL to display in the browser window. The possible values for this parameter are: _blank  Load the link into a new unnamed window. 
    _parent  Load the link into the immediate parent of the document the link is in. 
    _self  Load the link into the same window the link was clicked in. 
    _top  Load the link into the full body of the current window. 
    <window_name>  A named HTML frame. If no frame or window exists that matches the specified target name, a new window is opened for the specified link.  
     
    PostData Optional. Data to send to the server during the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form to a program or script. If this parameter does not specify any post data, the Navigate2 method issues an HTTP GET transaction. This parameter is ignored if URL is not an HTTP URL.  
    Headers Optional. A value that specifies additional HTTP headers to send to the server. These headers are added to the default Internet Explorer headers. The headers can specify things like the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if URL is not an HTTP URL.  
    Applies ToInternetExplorer, WebBrowser 
      

  6.   

    非常感谢antshome(星星我来了) ,问题解决了。但是我的疑问还是没办法消除,不过之前我不知道WebBrowser还可以直接访问Web页面中间元素。现在能做到这样的话,用一个初始Web页把要提交的参数设置好了之后,再调用b表单的Submit方法是一个不错的方法,再次感谢!
    PostData Optional. Data to send to the server during the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form to a program or script. If this parameter does not specify any post data, the Navigate2 method issues an HTTP GET transaction. This parameter is ignored if URL is not an HTTP URL.