'.NET Winforms WebView2, open HTML file with an anchor

I'm currently moving to the WebView2 control from the .NET WebBrowser control and have run into an issue opening a HTML file that has an anchor in the path.

For example with the current WebBrowser control, I can open a local HTML file like so: "c:\test.html#1111" where the 1111 is the anchor. The browser control opens the file and goes to the anchor. However, with the webview2 control, I get a file not found error. If I leave off the anchor part of it, it opens fine.

Can someone please point me in the right direction to open up the file and go to the anchor? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source