472,143 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

Using Webbrowser to load a page from a file with a query string?

Am a novice at this. Trying to write a piece of code for personal use. Intent is to load a web page from a file (.html) and pass to it three parameters using a query string. Code is written in Visual C# with .net CF 3.5. Target platform is Windows Mobile. Using Windows Mobile 6 SDK. Example code is below passing only one parameter:

Expand|Select|Wrap|Line Numbers
  1.         private void RefreshData()
  2.         {
  3.             string temp_url="file://\\Program Files\\Test\\Test.html";
  4.             string PostDataStr = "?Type=NewType";
  5.  
  6.             temp_url = temp_url + PostDataStr;
  7.  
  8.             Uri address = new Uri(temp_url);
  9.             webBrowser.Navigate(address);
  10.         }
  11.  
When I try to run this on the emulator, it gives an unhandeld exception at the webBrowser.Navigate line. If I try to run it without the "PostDataStr" (no query string) it loads fine. Have spent hours searching for the correct way to do this, to no avail. What is the best method for doing this? If this has been answered elsewhere, I apologize in advance and please direct me to the appropriate post.
Mar 15 '10 #1
2 3170
markmcgookin
648 Expert 512MB
Well you are trying to execute some form of back end code on the file. This can only be achieved with server side processing... and unless you are going to run a web server on the PDA... that ain't gonna work locally.

If the site was running on a web server with a valid URL that you could visit on a desktop machine and pass that argument on this might work but not a local static html file.... for a start you can't do any processing in html.. it's just markup.
Mar 15 '10 #2
Thanks for the quick reply. Obviously, I do not do this for a living! Good thing. That being said, is there a managed code (Visual C#) way to load a local .html file into a web browser-type form and pass certain parameters to the file (the file is java script and the parameters are values I am reading out of the registry). Seems to me, there should be some way of doing this, although the way I have shown is obviously not the correct one...
Mar 16 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Dr. Oz | last post: by
2 posts views Thread by bhavik | last post: by
reply views Thread by =?Utf-8?B?SnVsaWEgQg==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.