求帮忙 路径中具有非法字符。

fanyoubang 2012-10-26 11:08:51
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.ArgumentException: 路径中具有非法字符。

源错误:


行 132: dt.Columns.Add(new DataColumn("最后登入", typeof(DateTime)));
行 133: dt.Columns.Add(new DataColumn("订单数", typeof(int)));
行 134: MembershipUserCollection allUser = Membership.GetAllUsers();
行 135: NameValueCollection allUser2 = getAlluser2Info();
行 136: foreach(MembershipUser user in allUser)


源文件: f:\book store\App_Code\Db.cs 行: 134

堆栈跟踪:


[ArgumentException: 路径中具有非法字符。]
System.IO.Path.CheckInvalidPathChars(String path) +2876062
System.IO.Path.Combine(String path1, String path2) +37
System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString) +455
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +87
System.Web.Security.SqlMembershipProvider.GetAllUsers(Int32 pageIndex, Int32 pageSize, Int32& totalRecords) +1658
System.Web.Security.Membership.GetAllUsers(Int32 pageIndex, Int32 pageSize, Int32& totalRecords) +63
System.Web.Security.Membership.GetAllUsers() +26
Db.GetAllUser() in f:\book store\App_Code\Db.cs:134

[TargetInvocationException: 调用的目标发生了异常。]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +480
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1960
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360




--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1891; ASP.NET 版本:2.0.50727.1887
...全文
19104 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cszwdn 2013-05-27
  • 打赏
  • 举报
回复
// 快速剔除一串字符串中不合法的文件名或者文件路径字符 string rPath = @"\\192.168.1.3\2013-05\2013-05-27\转发___[インターネットファイルn???陨?.com.cn"; // "路径"; StringBuilder rBuilder = new StringBuilder(rPath); foreach (char rInvalidChar in Path.GetInvalidFileNameChars()) rBuilder.Replace(rInvalidChar.ToString(), string.Empty); strNewFileName = rBuilder.ToString(); // 新的文件名就正常了
wuyq11 2012-10-26
  • 打赏
  • 举报
回复
Membership.GetAllUsers
哪里使用列路径,检查连接字符串
fanyoubang 2012-10-26
  • 打赏
  • 举报
回复
断点后的

- dt {} System.Data.DataTable
+ base {} System.ComponentModel.MarshalByValueComponent {System.Data.DataTable}
CaseSensitive false bool
+ ChildRelations {System.Data.DataRelationCollection.DataTableRelationCollection} System.Data.DataRelationCollection {System.Data.DataRelationCollection.DataTableRelationCollection}
+ Columns {System.Data.DataColumnCollection} System.Data.DataColumnCollection
+ Constraints {System.Data.ConstraintCollection} System.Data.ConstraintCollection
+ DataSet null System.Data.DataSet
+ DefaultView {System.Data.DataView} System.Data.DataView
DisplayExpression "" string
+ ExtendedProperties Count = 0 System.Data.PropertyCollection
HasErrors false bool
IsInitialized true bool
+ Locale {zh-CN} System.Globalization.CultureInfo
MinimumCapacity 50 int
Namespace "" string
+ ParentRelations {System.Data.DataRelationCollection.DataTableRelationCollection} System.Data.DataRelationCollection {System.Data.DataRelationCollection.DataTableRelationCollection}
Prefix "" string
PrimaryKey {System.Data.DataColumn[0]} System.Data.DataColumn[]
RemotingFormat Xml System.Data.SerializationFormat
+ Rows {System.Data.DataRowCollection} System.Data.DataRowCollection
Site null System.ComponentModel.ISite
TableName "" string
+ 静态成员
+ 非公共成员
allUser null System.Web.Security.MembershipUserCollection
allUser2 null System.Collections.Specialized.NameValueCollection
fanyoubang 2012-10-26
  • 打赏
  • 举报
回复
不行的啊
bdmh 2012-10-26
  • 打赏
  • 举报
回复
调试跟踪getallusers,是不是里面连接数据库的字符串中有非法字符或者文件路径不合法
蝶恋花雨 2012-10-26
  • 打赏
  • 举报
回复
设置断点134行跟进去
System.Web.Security.SqlMembershipProvider.GetAllUsers(Int32 pageIndex, Int32 pageSize, Int32& totalRecords) +1658

看看那个参数的值不对。

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧