|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
POSTing data with System.Windows.Forms.WebBrowser: Vista vs XPthat uses a WebBrowser control to POST data to an external website. Here is some sample code: string postStr = "parm1=hello"; postStr += "&parm2=world"; byte[] postBytes =Encoding.UTF8.GetBytes(postStr); WebBrowser webBrowser = new WebBrowser(); webBrowser.Navigate("http://www.mydomain.com/post_here", "_blank", postBytes, "Content-Type: application/x-www-form-urlencoded" + "\n" + "\r"); This works just fine when the app runs in Windows XP, but with Vista, the data isn't properly posted. After further investigation, I did a network trace (with ethereal), and discovered that while the XP instance sent a HTTP POST with my data (correct), Vista sent a HTTP GET, resulting in the error. Is there a known issue with System.Windows.Forms.WebBrowser POSTing data on Vista? In article <1173330298.838714.90***@p10g2000cwp.googlegroups.com>,
j***@kalikstein.com says... > I have a C# Winforms app developed with Visual Studio Express Edition I would try using the WebRequest classes for this sort of thing. > that uses a WebBrowser control to POST data to an external website. Probably much lighter than the WebBrowser class and you'll have more control: http://tinyurl.com/99v7 On Mar 9, 7:49 pm, Patrick Steele <patr***@mvps.org> wrote:
> In article <1173330298.838714.90***@p10g2000cwp.googlegroups.com>, Thanks for your response, Patrick. I think the WebBrowser control is> j***@kalikstein.com says... > > > I have a C# Winforms app developed with Visual Studio Express Edition > > that uses a WebBrowser control to POST data to an external website. > > I would try using the WebRequest classes for this sort of thing. > Probably much lighter than the WebBrowser class and you'll have more > control: > appropriate for my application, because I was the user to be navigated to the POSTed page. I had a fully functional implementation that suited my needs for Windows XP, but the same code doesn't work in Vista, so I really do think this is a bug that should be addressed. In any event, I worked around the problem by having my program create a .html file embedded with javascript POSTing code and then WebBrowser.Navigate-ing to the html file. -jeff In article <1173492137.137223.192***@v33g2000cwv.googlegroups.com>,
j***@kalikstein.com says... > Thanks for your response, Patrick. I think the WebBrowser control is Ahhh. I see. Yeah, if you need to do browsing too, the WebBrowser > appropriate for my application, because I was the user to be navigated > to the POSTed page. class is what you need. > In any event, I worked around the problem by having my program create Glad you got it fixed! > a .html file embedded with javascript POSTing code and then > WebBrowser.Navigate-ing to the html file. |
|||||||||||||||||||||||