asp.net中C# "不支持给定路径的格式"高手指导
System.NotSupportedException:不支持给定路径的格式。源错误:行19:return;行20:}行21:strings=Server.MapPat...
System.NotSupportedException: 不支持给定路径的格式。
源错误:
行 19: return;
行 20: }
行 21: string s = Server.MapPath("../Document/" + addFile.PostedFile.FileName);
行 22: addFile.SaveAs(s);
行 23:
堆栈跟踪:
[NotSupportedException: 不支持给定路径的格式。]
System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) +9368832
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) +254
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +85
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path) +63
System.Web.InternalSecurityPermissions.PathDiscovery(String path) +29
System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) +146
System.Web.HttpRequest.MapPath(VirtualPath virtualPath) +37
System.Web.HttpServerUtility.MapPath(String path) +99
Manage_AddDocument.btnAdd_Click(Object sender, EventArgs e) in e:\Course_study\Manage\AddDocument.aspx.cs:21
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 展开
源错误:
行 19: return;
行 20: }
行 21: string s = Server.MapPath("../Document/" + addFile.PostedFile.FileName);
行 22: addFile.SaveAs(s);
行 23:
堆栈跟踪:
[NotSupportedException: 不支持给定路径的格式。]
System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) +9368832
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) +254
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +85
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path) +63
System.Web.InternalSecurityPermissions.PathDiscovery(String path) +29
System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) +146
System.Web.HttpRequest.MapPath(VirtualPath virtualPath) +37
System.Web.HttpServerUtility.MapPath(String path) +99
Manage_AddDocument.btnAdd_Click(Object sender, EventArgs e) in e:\Course_study\Manage\AddDocument.aspx.cs:21
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 展开
展开全部
string s = Server.MapPath("~/Document/" + addFile.PostedFile.FileName);
试试
试试
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
string s = Server.MapPath("..\\Document\\" + addFile.PostedFile.FileName);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
请用管理员身分打开vs,你要操作的文件位置在系统盘,应该是访问权限的问题,具体还得查。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询