“/Netoffice6”应用程序中的服务器错误。
--------------------------------------------------------------------------------索引和长度必须引用该字符串内的位置。
参数名: length 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 索引和长度必须引用该字符串内的位置。
参数名: length源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[ArgumentOutOfRangeException: 索引和长度必须引用该字符串内的位置。
参数名: length]
   System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +2819959
   System.String.Substring(Int32 startIndex, Int32 length) +11
   components.DBDepartment.getDanweiCode(String deptCode) in E:\工作目录\T03\通用版OA6.0\程序\components\DBDepartment.vb:71
   netoffice.bizLogic.comFun.refreshSessionFromLoginID(String loginID) in E:\工作目录\T03\通用版OA6.0\程序\EpointNetoffice6\bizLogic\comFun.cs:452
   netoffice.login.Imagebutton1_Click(Object sender, ImageClickEventArgs e) in E:\工作目录\T03\通用版OA6.0\程序\EpointNetoffice6\login.aspx.cs:134
   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +105
   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +115
   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.832; ASP.NET 版本:2.0.50727.832 

解决方案 »

  1.   

    System.String.Substring(Int32 startIndex, Int32 length) +11 看看你的subString是否参数正确? 应该有越界的可能
      

  2.   

    ArgumentOutOfRangeException
    超出范围的错误。检查你的substring方法,肯定有问题。
      

  3.   

    索引和长度必须引用该字符串内的位置。 
    参数名: length 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 
    应该是你的循环中,要用I<LENGTH-1