Launch IE with a complex string

  • Thread starter Thread starter sreelakshmi
  • Start date Start date
S

sreelakshmi

Hi

I am working on integrating some help modules and i need to launch the
browser with a url like

X:/WebHelp_WithTOC/index.htm#mergedProjects/ProductA/ProductA_Form1.htm

while i can have a form and a webBrwoser control in it and pass this as
a URl, i want to specifially launch IE with this page.

The standard System.Diagnostics.Process.Start(String filename) does not
work in this case. The error is 'the specified file could not be
found'. In this function it considers the entire string to be proper
path for a file cos the string starts with X:.

How can i launch this url in a new instance of IE?

Thanks
 
Thanks,

I tried

System.Diagnostics.Process pr = new System.Diagnostics.Process();

pr.StartInfo.FileName = "iexplore";

pr.StartInfo.Arguments =
"C:/SmartClient/WebHelp_WithTOC/index.htm#mergedProjects/ProductA/ProductA_Form1.htm";

pr.Start();

This works. Though i was looking for a neater solution where there is
no need to call 'iexplore' explicitly. Is there no way to display a url
on the default browser?

Thanks,
 
Hi there,

You'd have to convert your complex URL into an escaped URL. This
does the trick:

Dim theUri As System.Uri = New System.Uri( yourVeryComplexString )

And this'll start the default browser.

Diagnostics.Process.Start( theUri.AbsoluteUri() )


HTH,
Marius.
 
Back
Top