Ok, very silly of me. Using the WebBrowser
control was indeed the answer. But it had extra parameters, in the Navigate
method, that allowed you to pass in post data. Don't know how I overlooked this. Thanks for the help anyway.
Sending POST request in WinForms app and displaying result in browser
-
02-06-2022 - |
题
I have to interact with a 3rd party web service. I call a method in the service using POST
and it returns a web page. This works fine, but the problem I have is that the web request is called from a windows forms application and the 3rd party expects the response to be shown in a browser. It sounds like it should be possible but I can't think of a way of passing the response to the browser.
解决方案 2
其他提示
The WebBrowser control is your best bet here.
The control exposes a DocumentStream property that lets you load content from a stream:
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentstream.aspx
You could also use the DocumentText property:
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext.aspx