2014-04-18 24 views
1

我们可以直接在浏览器中使用查询字符串(GET数据)打开页面。 有没有什么办法直接在具有POST DATA的浏览器中打开页面。如何在具有发布数据的浏览器中直接打开页面

+0

你想这样做,从一个WinForms/WPF应用程序或从ASP.NET页? – ChrFin

+0

我不想从编程的角度来看它。我只是想知道是否可以直接使用浏览器打开,因为我们在GET方法中通过传递查询字符串 – user3138879

+0

来做到这一点,但这会产生差异。那么你怎么称呼它?理论上它是可能的,但如果它实际上可能取决于“如何”...... – ChrFin

回答

0

通过使用WebBrowser控件打开与POST数据的网址:

string url = "http://example.com"; 
    string postData = "param1=value1&param2=value2&param3=value3"; 
    byte[] Post = Encoding.UTF8.GetBytes(postData); 
    string AdditionalHeaders = "Content-Type: application/x-www-form-urlencoded"; 
    //wbSample is the web browser control 
    //the WebNavigate method is just a simple method i created 
    //which simply assigns url to the browser, the post data and additional headers 
    WebNavigate(wbSample , ListURL, "", Post, AdditionalHeaders); 
相关问题