Welcome Guest Search | Active Topics | Sign In | Register

Need a way to handle redirect url Options
ruk
Posted: Tuesday, February 23, 2021 12:51:14 PM
Rank: Advanced Member
Groups: Member

Joined: 5/15/2017
Posts: 48
We are currently porting from CefSharp to EO web control. We have an authentication related code from our WPF application where we used CefSharp embedded web control. The embedded web control is set with an URL to authentication server. After the login page is displayed and user submits the page, we need to handle the redirect URL coming from the server.

Here is how we did with CefSharp.
Code: C#
browser = new ChromiumWebBrowser(uri);
browser.RequestHandler = new RequestHandler(new LoginResourceRequestHandler(this));

// OnResourceRedirect is called after the server redirect 
class LoginResourceRequestHandler : IResourceRequestHandler
{
	public void OnResourceRedirect(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl)
       {
                // We need value of this redirect url - newUrl
		// Check the value of the redirect and handle it
                if (newUrl.StartsWith("com.myclientapp://myclientapp.com/callback"))
                {
                	...
                }
       }
	...
}

We need a way to get this redirect url from EO web browser. Not sure how to do this in EO yet. Any help is highly appreciated.
eo_support
Posted: Tuesday, February 23, 2021 2:43:30 PM
Rank: Administration
Groups: Administration

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

I am not exactly sure how the server passes the new Url to you. Typically it is passed through a HTTP 302 Redirect response, with the new Url in the response header. In this case you can handle the WebView's AfterReceiveHeaders event and the new Url would appear in e.Response.RedirectLocation property.

Thanks!
ruk
Posted: Tuesday, February 23, 2021 4:38:20 PM
Rank: Advanced Member
Groups: Member

Joined: 5/15/2017
Posts: 48
Thank you for the quick response.


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.