Search code examples
c#-4.0httpwebrequestwebbrowser-controlwebclientsystem.net.httpwebrequest

.Net Windows webBrowser - how to extract authorization header from webBrowser response and send to another consecutive request?


I have a windows desktop application. I need to open SSO login page in windows application. For this, I am using windows web browser control to open SSO login page. Once successfully logged-in, I need to get Authorization header from SSO login and use this authorization token for consecutive REST calls.

The issue here is, I am not able to extract authorization header Navigated and DocumentCompleted events. Can anyone suggest how I can extract this authorization header from the first call and how I can use the same header for subsequent REST calls?

Thanks in advance!!


Solution

  • I resolved this myself.

    As I explained in question, for Entitlement login, I'm login to actual website login page. Once I logged in to login page, I receives authorization token from response in DocumentCompleted event. And I am using same token for subsequent REST calls.