Is it possible to transfer authentication from Webbrowser to WebRequest

后端 未结 9 2104
无人共我
无人共我 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:29

    One possible way to do this is to get the cookie by using InternetGetCookie function, construct corresponding cookie object and use it for the CookieContainer

    To retrieve HttpOnly cookies use InternetGetCookieEx

    Here are some examples:

    InternetGetCookie() in .NET

    Download using Internet Explorer Cookies

提交回复
热议问题