WebBrowser control navigation problem

K

Krupa

Hi All,

I had no way but to repost this question as I am not able to fix this
probelm yet. I am trying to navigate to a Uri in my C# app on CF 2.0,
but getting an exception. Please find the code below.

webBrowser1.Navigate(new Uri(@"/Storage
Card/Flash/GPSRanger.html?GPSRanger.swf"));

I get an exception when I have a query string in the Uri and not
otherwise. Surprisingly, this works when I paste this exct Uri in a
browser and run it but crashes in my app. I also tried replacing the
special characters (? and .) with the URL encoding, but it didn't help.
Any suggestions?

Thanks,
Krupa
 
K

Krupa

Alex, it gives me an unrecognised escape sequence error when I tried
your suggestion. It didn't let me use backward slashes.

I think the problem I have is that I am using query string with a local
filepath, and not a webserver path. It works with the following url:
Uri myUri = new
Uri("http://www.contoso.com/catalog/shownew.htm?date=today");

while my uri format is:
Uri myUri = new Uri(@"/Storage
Card/Flash/GPSRanger.html?movie=GPSRanger.swf");

Can someone help me on how to insert a query string to a Uri that is a
local file path?

Thanks,
Krupa
 
G

Guest

This worked for me:

Uri myUri = new Uri(@"file://\Windows\default.htm?movie=GPSRanger.swf");
webBrowser1.Navigate(myUri);

--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org


Krupa said:
Alex, it gives me an unrecognised escape sequence error when I tried
your suggestion. It didn't let me use backward slashes.

I think the problem I have is that I am using query string with a local
filepath, and not a webserver path. It works with the following url:
Uri myUri = new
Uri("http://www.contoso.com/catalog/shownew.htm?date=today");

while my uri format is:
Uri myUri = new Uri(@"/Storage
Card/Flash/GPSRanger.html?movie=GPSRanger.swf");

Can someone help me on how to insert a query string to a Uri that is a
local file path?

Thanks,
Krupa
 
K

Krupa

Alex,

When I do the following:
Uri myUri = new
Uri("http://www.contoso.com/catalog/shownew.htm?date=today");
string test1 = myUri.Query;

The value in test1 is "?date=today".

But when I do,
Uri query = new Uri(@"file://\Storage
Card\Flash\GPSRanger.html?movie=GPSRanger.swf");
string test2 = query.Query;

test2 shows anull string after execution! Do you know where I am going
wrong?

-Krupa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top