1
我试图设置一个页面,允许用户从共享驱动器(其中该文件实际上是通过该页面发送的)下载文件。到目前为止,这是我的。System.InvalidOperationException:无法映射'/ sharedDrive/Public'路径
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();
}
}
ASPX页面看起来有点像这样:
<% Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name); %>
<ul>
<% foreach (System.IO.FileInfo f in files)
{
Response.Write("<li>" + f.FullName + "</li>");
} %>
</ul>
当我删除代码的错误部分,网页告诉我,我使用的是Windows身份验证我的用户(其可以访问驱动器)。我不明白这个问题会是什么,甚至是抱怨什么。
很好的解释。我很确定它现在工作正常:) – 2010-06-18 16:08:32