System.InvalidOperationException: Failed to map the path...

lakhi
lakhi used Ask the Experts™
on
I am trying to set up some web pages. They are very simple, just listing out files in different directories and linking to them.

The directories are on another server on the network. There is a virtual directory called "F-Drive" on our main network server set up for this purpose

My problem arose when I tried to do a server.mapPath to bind the links to a gridview and I received the error mentioned above -  "Failed to map the path..."

This is the line it bombed out on:
Dim dirInfo As New System.IO.DirectoryInfo(Server.MapPath("/F-Drive/Departments/Test/Shares/Docs/TestDocs"))

I don't know if it's a permissions issue or a web.config setting.

I would appreciate any help wtih this.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use the Server.MapPath  only for the current virtual directory in which your web site/application is running.

For external directory and network paths you need to use the impersonation.

For more info in impersonation:
http://stackoverflow.com/questions/10180454/asp-net-intranet-web-site-writing-text-files-to-a-network-folder
http://www.hanselman.com/blog/AccessingMappedNetworkDrivesViaASPNETInIIS6.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial