How To Get The Browser Hosted Query String In WPF Application

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.
  1. <body>  
  2.     <div>  
  3.         <iframe src="http://localhost:100/[email protected]" width="1000" height="600" scrolling="auto"></iframe>  
  4.     </div>  
  5. </body>  
 Now code to get this file name in WPF app. 
  1. //get the filename from query string  
  2.            string RawUrl = BrowserInteropHelper.Source.AbsoluteUri;  
  3.            Uri myUri = new Uri(RawUrl, UriKind.RelativeOrAbsolute);  
  4.            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,