CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
383 stars 89 forks source link

[WebView] - URL with internal redirects not working in WebView #276

Closed vikramrkin closed 4 years ago

vikramrkin commented 4 years ago

Hi,

I am using WebView control - version 6.1.0 on Win10 machine (17763 build). My project targets .net 4.8.

I have built a simple web forms app which calls WebView's Navigate() function. The URL I am trying to load from WebView is in similar to "https://companyib--uat2--c.visualforce.com/apex/NMR_Outlook". Traditional WebBrowser component is able to load this URL.

However, WebView fails to load this. I have hooked up NavigationStarting and NavigationCompleted events of WebView. Here is the output I get (all URL params are truncated for brevity):

  1. Navigation started to 'https://companyib--uat2--c.visualforce.com/apex/NMR_Outlook'
  2. Navigation started to https://companyib--uat2.my.salesforce.com/saml/authn-request.jsp?saml_request_id=_ErW3Rw&saml_acs=https%3A%2F%2Fcompanyib--uat2.my.salesforce.com&saml_binding_type=HttpRedirect&Issuer=https%3A%2
  3. Navigation started to https://sso-core-int.company.com/am/SSORedirect/metaAlias/Internal/COMPany-iDP-int?SAMLRequest=2BpOnINhtgMw%3D%3D
  4. Error navigating to https://sso-core-int.company.com/am/SSORedirect/metaAlias/Internal/COMPany-iDP-int?SAMLRequest=2BpOnINhtgMw%3D%3D. ERROR IS 'NotFound'

Any idea what I am missing with WebView? The SSO service used by my company might be doing a POST, I am not sure. Does WebView support POST?

Also, I am unable to use WebView2 at the moment due to corporate policy restrictions on installing Edge Canary Channel.

Thanks for reading Vikram

vikramrkin commented 4 years ago

I found answer to my query. Thanks to this post: https://github.com/windows-toolkit/Microsoft.Toolkit.Win32/issues/244

I just had to set IsPrivateNetworkClientServerCapabilityEnabled=true and it started working. Thanks to this forum!