cs代码:
protected void Button4_Click(object sender, EventArgs e)
{
File1.PostedFile.SaveAs(@"E:\Inetpub\LocalUser\jiaoyou\temp");
}
html代码:
input id="File1" type="file" name="File1" style="width: 397px" runat="server" />操作系统win2003 硬盘分区fat32 .net版本2.0
就是提示 对路径“E:\Inetpub\LocalUser\jiaoyou\temp”的访问被拒绝。
IUSR_XXX我给给了Administrator组了<identity impersonate="true"/>也加到web.config中的
具体错误提示如下:
用户代码未处理 System.UnauthorizedAccessException
Message="对路径“E:\\Inetpub\\LocalUser\\jiaoyou\\temp”的访问被拒绝。"
Source="mscorlib"
StackTrace:
在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
在 System.IO.FileStream..ctor(String path, FileMode mode)
在 System.Web.HttpPostedFile.SaveAs(String filename)
在 _Default.Button4_Click(Object sender, EventArgs e) 位置 e:\Inetpub\LocalUser\jiaoyou\dlcg.aspx.cs:行号 38
在 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
protected void Button4_Click(object sender, EventArgs e)
{
File1.PostedFile.SaveAs(@"E:\Inetpub\LocalUser\jiaoyou\temp");
}
html代码:
input id="File1" type="file" name="File1" style="width: 397px" runat="server" />操作系统win2003 硬盘分区fat32 .net版本2.0
就是提示 对路径“E:\Inetpub\LocalUser\jiaoyou\temp”的访问被拒绝。
IUSR_XXX我给给了Administrator组了<identity impersonate="true"/>也加到web.config中的
具体错误提示如下:
用户代码未处理 System.UnauthorizedAccessException
Message="对路径“E:\\Inetpub\\LocalUser\\jiaoyou\\temp”的访问被拒绝。"
Source="mscorlib"
StackTrace:
在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
在 System.IO.FileStream..ctor(String path, FileMode mode)
在 System.Web.HttpPostedFile.SaveAs(String filename)
在 _Default.Button4_Click(Object sender, EventArgs e) 位置 e:\Inetpub\LocalUser\jiaoyou\dlcg.aspx.cs:行号 38
在 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
另外E:\Inetpub\LocalUser\jiaoyou\temp这种客户端的路径应该改成
Server.MapPath("相对路径"),否则本机没什么问题,其他机器访问会有问题的
http://blog.csdn.net/knight94/archive/2006/03/31/646252.aspx