Rank: Newbie Groups: Member
Joined: 8/1/2014 Posts: 1
|
I was wondering if it was possible to use the WebView component of EO.WebBrowser in an ASP.NET (VB) application to facilitate Single Sign-On between multiple Web sites.
My organization has a Web-based Portal that everybody logs into. I would like to be able to have my user click a link that would take them to a Web page in my Portal. This page would create an instance of WebView, load a second Web site, programmatically assign username/password, then simulate the submit button click, and then redirect the user to this Web site in a logged in state.
I've tried the following to no luck, but was just wondering if this concept was even possible. Ideally this second Web site would provide me with an API for SSO, but they do not. Because of that I'm looking to see if there is a way to programmatically simulate the login.
Dim objWebBrowser As New EO.WebBrowser.WebView objWebBrowser.LoadUrl("http://example.com/")
objWebBrowser.EvalScript("document.getElementById('username_field').value = 'TestUser';") objWebBrowser.EvalScript("document.getElementById('password_field').value = 'TestPassword';")
objWebBrowser.EvalScript("document.getElementById('submit_button').click();")
Response.Redirect("http://example.com/")
Thanks!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
You can not do that. These two things live in two totally different worlds ---- the page that you are trying to load with WebView run on your web server inside a WebView instance. The page that you actually wanted to login runs on the end user's machine inside whatever browser he is using. These two have nothing to do with each other at all.
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 7/7/2014 Posts: 60
|
Just a comment: we have something similar in a primary web client and several web API services. The services authenticate either via HTTP authentication or cookie authorization. The web client passes the cookie along and we validate as below. Not sure if this will work in your case or not - in order for this to work the services & web client share the cookie authentication: validation key, authentication stuff. This is in the web.config files. Anyway, so if you could share that authentication with your portal and your company portal, that may work.
if (HttpContext.Current.Request.IsAuthenticated) return new UserAuthentication() { UserName = HttpContext.Current.User.Identity.Name };
|