当前位置:编程学习 > C#/ASP.NET >>

发布网站到服务器的时候报错 : Index was outside the bounds of the array.

Server Error in '/' Application. 
--------------------------------------------------------------------------------

Index was outside the bounds of the array.
 

 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error: 
             string[] userIDSID;
             if (!IsPostBack)
Line 58:     {
Line 59:       userIDSID = User.Identity.Name.Split('\\');
Line 60:       this.TextBox_IDSID.Text = userIDSID[1];
Line 61: 
Line 62:       DDMgr.initialDDListProject(DropDownList_Project); 

Source File: e:\DEMO\JCTP_NEW_01-14\JCTP_NEW_01-14\Default.aspx.cs    Line: 60 

Stack Trace: 

[IndexOutOfRangeException: Index was outside the bounds of the array.]
  _Default.Page_Load(Object sender, EventArgs e) in e:\DEMO\JCTP_NEW_01-14\JCTP_NEW_01-14\Default.aspx.cs:60
  System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
  System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
  System.Web.UI.Control.OnLoad(EventArgs e) +132
  System.Web.UI.Control.LoadRecursive() +66
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955

--------------------编程问答-------------------- userIDSID = User.Identity.Name.Split('\\');
if(userIDSID.length>1)
{
this.TextBox_IDSID.Text = userIDSID[1];
} --------------------编程问答-------------------- 先判断userIDSID 是否有元素
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,