I'm looking / asking and I'm not able to understand that. I have a C # application and need to be able to gather some data in the app, open a web browser and post some data to it.
I can post the site properly in the app and I can obviously open IE on a certain link but I can not do both. Can not I post directly on that link Any ideas about how to accomplish this?
Private zeros btnSubmit_Click (Object Sender, EventArgs e) {ASCIIEncoding encoding = new ASCIIEncoding (); String postdata = "full name = test"; Byte [] Data = Encoding Getbytes (postdata); // Create web request ... HttpWebRequest myRequest = (HttpWebRequest) WebRequest.Create ("http://www.url.com/Default.aspx"); MyRequest.method = "Post"; MyRequest.ContentType = "application / x-www-form-urlencoded"; MyRequest.ContentLength = data.Length; Stream newstream = myRequest.GetRequestStream (); // Send data new stream. Write (data, 0, data. Lang); System.Diagnostics.Process.Start (myRequest.Address.ToString ()); // open browser newStream.Close (); }
Any insights will be greatly appreciated.
Thanks
If this is a WinForms application, Instead of growing, you can use the controls to host an example of Internet Explorer. The advantage of this is that you have full control over it and you can post a given url except for the other:
Private zeros btnSubmit_Click (Object Sender, EventArgs e) {var postData = Encoding.Default .GetBytes ("full name = test"); WebBrowser1.Navigate ("http://www.url.com/Default.aspx", blank, postdata, "content-type: app / x-www-form-urxed" + new line); }
Comments
Post a Comment