Question

The code I have so far is this:

System.Diagnostics.Process.Start("iexplore.exe", "filename.xml");

It does launch internet explorer, but the URL shows: "http://filename.xml/" and of course can't be displayed.

The xml file is located in the bin/Debug folder.

Was it helpful?

Solution

The problem was that the relative path was not providing the full path to internet explorer, so I had to use this:

System.Diagnostics.Process.Start("iexplore.exe", Path.GetFullPath("filename.xml"));

Make sure to add using System.IO to your program as well.

OTHER TIPS

string path = System.IO.Path.Combine(
                     System.IO.Directory.GetCurrentDirectory(),
                     "filename.xml");
System.Diagnostics.Process.Start("iexplore.exe", path);

You should write the complete path to the file with "file:///" added in the beginning.

something like that would work

string sXmlPath = System.IO.Path.Combine(Application.StartupPath, "filename.xml");
System.Diagnostics.Process.Start("iexplore.exe", sXmlPath);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top