Is it possible to transfer authentication from Webbrowser to WebRequest

后端 未结 9 2122
无人共我
无人共我 2020-11-27 14:10

I\'m using webbrowser control to login any site. And then i want to download some sub page html using WebRequest (or WebClient). This links must requires authentication.

9条回答
  •  我在风中等你
    2020-11-27 14:37

    If you can retrieve the necessary cookies from the WebBrowser control after they are set by the site you are logging into, you should be able to use those same cookies with WebRequest/WebClient.

    This article outlines how to use cookies with a WebClient; you have to subclass it, but it's only a single override that's needed.

提交回复
热议问题