开发者

Can I read the contents of an Ajax request using the WebBrowser control?

开发者 https://www.devze.com 2023-03-21 01:07 出处:网络
I\'m trying to read the contents of an AJAX response in the WebBrowser control in C#/WinForms. The Navigating/Navigated/etc. events seem to fire, but they don\'t give any access to the data being retu

I'm trying to read the contents of an AJAX response in the WebBrowser control in C#/WinForms. The Navigating/Navigated/etc. events seem to fire, but they don't give any access to the data being returned.

Is there any way to intercept the requests and read the data?

Note: If I send the request directly (using webBrowser.Navigate(ajaxUrl)) the WebBrowser controls pops up asking the user to Open/Save the page (as it has a content-disposition header), so that isn't an option. I tried doing it manually with a WebClient/WebRe开发者_如何转开发quest, but I can't get the cookies to work correctly (the cookies I read from document.cookie do not seemto match the cookies actually sent with the AJAX request!).


No, you cannot capture XMLHTTPRequests from the web-browser control using the methods of the Web Browser control. You might want to have a look at http://www.fiddler2.com/core/

0

精彩评论

暂无评论...
验证码 换一张
取 消