Welcome Guest Search | Active Topics | Sign In | Register

Remember credetials and auto login in EO.WebBrowser Options
Khoa
Posted: Thursday, July 14, 2016 4:23:06 PM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Hi,

I want to know how EO.WebBrowser can remember username/password to auto login like Google Chrome. Many web browsers store credentials somewhere to allow to jump right the page without login in. I would like to see how we can do it with EO.WebBrowser.

Thank you.
eo_support
Posted: Thursday, July 14, 2016 5:33:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You will need to do that part yourself and then handle the WebView's NeedCredentials to supply them to the browser engine. Google Chrome browser does do that but that is not a part of the core browser engine so it does not exist in EO.WebBrowser.

Thanks!
Khoa
Posted: Thursday, July 14, 2016 11:44:27 PM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Thank you for your reply. However, I don't see the WebView's NeedCredentials to get fired, even with login and logout, reopen the EO.WebBrowser instance to login again but this event is never got fired. Could you please give me an example to use this NeedCredentials event.

I am using the current latest version 16.1.46.

Thanks.
eo_support
Posted: Friday, July 15, 2016 10:57:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

NeedCredentials is only fired when there is a "401 Unauthorized" response. If your website automatically redirects to a login page (thus still responds 200), the WebView has no way of knowing that it is actually a login page. In that case NeedsCredentials will not be fired. In order to automatically log into those pages, there are two options:

1. Automatically detects form fields and "guess" whether it's a login page, and uses auto fill mechanism to automatically fills in the form fields, then submit the page. EO.WebView only provides interface for you to read/write form fields and you will need to implement everything else;

2. If the server uses cookies to store authentication ticket, then you can capture the cookies and then attach it to the WebView's BeforeRequestLoad event later. That will automatically authenticate you with the server;

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!
Khoa
Posted: Monday, July 18, 2016 6:01:00 PM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Your suggestion works. I am working with the 2nd option. However, how can I get the CookieCollection inside the WebView's BeforeRequestLoad event?

Thank you.
Khoa
Posted: Monday, July 18, 2016 6:08:44 PM
Rank: Advanced Member
Groups: Member

Joined: 9/3/2014
Posts: 68
Here is the code to help to clear my question:

Code: C#
private void webView_BeforeRequestLoad(object sender, BeforeRequestLoadEventArgs e)
{
    var cookie = new Cookie("COOKIENAME");
    // Where to get the CookieCollection of this webView to retrieve the cookie value from a given cookie name?
    cookie.Value = "xxx";
    e.Request.Cookies.Add(cookie);
}


Thank you.
eo_support
Posted: Monday, July 18, 2016 6:10:01 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You won't be able to get the cookies from BeforeRequestLoad. You can only get the cookies from AfterReceiveHeaders event.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.