System.InvalidOperationException: Failed to map the path '/sharedDrive/Public'
Posted
by d03boy
on Stack Overflow
See other posts from Stack Overflow
or by d03boy
Published on 2010-06-18T15:58:51Z
Indexed on
2010/06/18
16:03 UTC
Read the original article
Hit count: 659
I'm trying to set up a page that will allow users to download files from a shared drive (where the file is actually sent via the page). So far this is what I have.
public partial class TestPage : System.Web.UI.Page
{
protected DirectoryInfo dir;
protected FileInfo[] files;
protected void Page_Load(object sender, EventArgs e)
{
dir = new DirectoryInfo(Server.MapPath(@"\\sharedDrive\Public"));
files = dir.GetFiles();
}
}
The aspx page looks kind of like this:
<% Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name); %>
<ul>
<% foreach (System.IO.FileInfo f in files)
{
Response.Write("<li>" + f.FullName + "</li>");
} %>
</ul>
When I remove the erroneous parts of the code, the page tells me that the Windows Identity I'm using is my user (which has access to the drive). I don't understand what the problem could be or what it's even complaining about.
© Stack Overflow or respective owner