In making payment jump to browser third party payment platform, then need to open and submit some information with the browser; There is no get method here, because the parameters are too exposed;
Of course, the important parameters are to be encrypted.
The normal way to invoke the browser is to open the Web page:
Call IE browser System.Diagnostics.Process.Start ("Iexplore.exe", "http://g.cn"); Call the system default browser System.Diagnostics.Process.Start ("http://g.cn");
Here I need to call IE to post some order form data, and then further jump to the payment platform:
Using the WebBrowser control, the Navigate method
1 //2 //Summary:3 //navigates asynchronously to the document at the specified System.Uri and specifies the target frame to which to load the document content. Other HTTP POST data and HTTP headers can be sent to the server as part of the navigation request. 4 //5 //Parameters:6 //Source:7 //the System.Uri to navigate to. 8 //9 //Targetframename:Ten //The name of the frame in which to display the document's contents. One // A //PostData: - //The HTTP POST data to be sent to the server when the source is requested. - // the //additionalheaders: - //The HTTP header to send to the server when the source is requested. - // - //Exception: + //system.objectdisposedexception: - //The System.Windows.Controls.WebBrowser instance is no longer valid. + // A //System.InvalidOperationException: at //failed to retrieve reference to base native WebBrowser. - // - //System.Security.SecurityException: - //navigating from an application running in a non-fully trusted state: Navigating to a System.Uri or targetframename name that is not at the source site is not null or empty. - Public voidNavigate (Uri source,stringTargetframename,byte[] PostData,stringAdditionalheaders);
Note that the parameter targetframename needs to be specified as "_blank" so that the form information submitted in the form will be executed in the newly opened browser page:)
New WebBrowser (); 2 byte [] BODY = Encoding.UTF8.GetBytes ("name=test&password=123"); Browser. Navigate ("http://www.domain.com/login? " " _blank " " content-type:application/x-www-form-urlencoded "
C # Open Browser and POST submission information