Here, I am going to explain about the browser hosted page to get content into WPF Browser Application.
Here's the process,
- First thing I created my Web Application into MVC 5 with C# and i hosted this application in IIS.
- I am sending the file name as a query string from Web Application to WPF Browser Application.
- I created the WPF Browser Application for scanning the documents from scanner check the below link to more details about WPF browser Application for scanner Click here to check the WPF solution.
- Just deploy and Host both application to different places.
- Now finally will see how to get the file name or any variable as query string which you are sending from WebApplication to WPF Application.
Here's the code,
This code you have to write on view page in mvc 5 or else you can use aspx to send the file name.
- <body>
- <div>
- <iframe src="http://localhost:100/[email protected]" width="1000" height="600" scrolling="auto"></iframe>
- </div>
- </body>
Now code to get this file name in WPF app.
-
- string RawUrl = BrowserInteropHelper.Source.AbsoluteUri;
- Uri myUri = new Uri(RawUrl, UriKind.RelativeOrAbsolute);
- string param1 = HttpUtility.ParseQueryString(myUri.Query).Get("Param");
Note: You have to use using System.Windows.Interop namespace.
For More details you can follow below links,
If you have any doubt or query you can reach to me any time by email or comment here.