Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Cannot find "file:///D://.....". Make sure the path or the internet address is correct.
 

Cannot find "file:///D://.....". Make sure the path or the internet address is correct.

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.

pankbug2000  Tuesday, October 07, 2008 10:25 AM

Hi folks,

Sorry but I wanted to clear one thing when I say directory's root I mean drive's root.

Thanks.

pankbug2000  Tuesday, October 07, 2008 10:28 AM

Hi pankbug2000

I have tested it but cannot recur the error. Please follow my step and do a test.

1. Copy “DefaultAdvertisement.htm�to the root of partition “D�

2. Run your application not at root of “D� but in the debug folder, change the code

Code Snippet

adFilePath = Application.StartupPath + "DefaultAdvertisement.htm";

TO

Code Snippet adFilePath = @"D:\DefaultAdvertisement.htm";

to see if it will throw out exception.

Sincerely,

Kira Qian

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Kira Qian  Thursday, October 09, 2008 6:30 AM

We are changing the issue type to “Comment�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Thank you!

Best Regards

Kira Qian

Kira Qian  Monday, October 13, 2008 9:44 AM

You can use google to search for other answers

Custom Search

More Threads

• How to build a install_layer for TaskVision?
• Smart Client problem with me
• Terrarium 1.2... Are there going to be 'stones' in Terrarium?
• linking
• Security Login Xml file
• How to Create a loop and save changes
• Unable to Install TV Server on Windows Server 2003 Std.
• Gameplay idea
• FTP In window form
• [ANN] Cool new stuff in the Animal Farm.