Search code examples
c#xmlinternet-explorerrelative-pathfilepath

Open an xml document in Internet Explorer using a relative path in C#


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.


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.