views:

32

answers:

2

When a IE browser control is embedded in a winform and the link on a page contains a relative file path the URL coming into the callback for the navigate event seems to lose "file:///../../dir/file.htm" and becomes "file:///dir/file.htm"

private void OnNavigating(object sender, WebBrowserNavigatingEventArgs e)
{
 // looking at e.Url to see what happens
}

Has anyone seen similar problems? Any suggestions?

+2  A: 

I think your URL is incorrect. If you want a relative path, just specify a relative path, such as ../../dir/file.htm. If your URL starts with a protocol specifier, then it's an absolute URL, where a .. at the start is superfluous, since you're already starting at the root of the file system.

Yuliy
+1  A: 

file:///../../dir/file.htm is not a valid url. By definition the URI cannot be relative.

(Hence the 'U' in URI/URL)

I agree with other suggestions here: don't use file:///, just specify the relative path directly.

John Weldon