Hi folks,
In my desktop application I have following code in a function:
try
{
string adFilePath =Application.StartupPath + "DefaultAdvertisement.htm";
if (File.Exists(adFilePath))
{
this.webBrowser.Navigate(adFilePath);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
This function works well when I run the application from any other place except when I run this code from a directory's root. Say if I paste the application's Debug folder content at D drive and run it gives me following error:
Cannot find "file:///D://DefaultAdvertisement.htm". Make sure the path or the internet address is correct.
But if i run same application from any non root folder than it works fine.
Please help me in this.
Thanks in advance.