Wpf: Webview in WPF app won't connect to intranet computer, but will connect to internet.

Created on 21 Feb 2019  Â·  3Comments  Â·  Source: dotnet/wpf

I have a small WPF app and I have a UserControl that I'm using "webview" in. I am using Visual Studio 2017 and doing the WPF app in C#. I use the UserControl in the main window. If I put in a URI for a site like Microsoft.com or Google.Com, "webview" will navigate to the site successfully. If I put in a local computer URI, "http://192.168.1.11/ panel", "webview" will not navigate and gives me an error of "Not Found". If I put this URI into the Edge browser it navigates successfully. I have been unsuccessful in finding why it won't navigate to a local computer. I have tried putting the WPF App's .exe assembly into allowed "app" in Windows Defender for both incoming and outgoing traffic. The Windows Defender log looks like it is dropping some of the outgoing traffic to the target computer. I have put the target computer in Internet Options as a trusted Intranet address. Nothing seems to work. I have run out of things to check. I can't seem to find similar issues for webview.

_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/464342/webview-in-wpf-app-wont-connect-to-intranet-comput.html
VSTS ticketId: 796996_
_These are the original issue comments:_
(no comments)
_These are the original issue solutions:_
(no solutions)

Most helpful comment

dotMorten: Your solution worked. Thanks for the quick response. Wayne

All 3 comments

This happens in UWP if you don’t add the “Private Networks” capability. Since WebView is UWP, I’m guessing you’re hitting something like this.
The solution is to set the IsPrivateNetworkClientServerCapabilityEnabled to true:

https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/2226#issuecomment-395915920

dotMorten: Your solution worked. Thanks for the quick response. Wayne

Thanks @WayneBBB for filing this issue and @dotMorten for providing the fix!

Closing since this issue has been resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bugproof picture bugproof  Â·  3Comments

Normandy picture Normandy  Â·  3Comments

juepiezhongren picture juepiezhongren  Â·  3Comments

lisberPontes picture lisberPontes  Â·  3Comments

lindexi picture lindexi  Â·  3Comments