Server Error in '/ClassCancellation' Application.

Index and length must refer to a location within the string.
Parameter name: length

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.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length

Source Error:


Line 209:        string timestring = string.Empty;
Line 210:
Line 211:        int mm = Convert.ToInt16(time.Substring(0, 2));
Line 212:        int ss = Convert.ToInt16(time.Substring(2, 2));
Line 213:        DateTime dt = new DateTime(2012, 1, 1, mm, ss, 0, 0);

Source File: c:\inetpub\ClassCancellation\mobilepage.aspx.cs    Line: 211

Stack Trace:


[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +14599300
   mobilepage.TimeString(String time) in c:\inetpub\ClassCancellation\mobilepage.aspx.cs:211
   mobilepage.CourseWeekDay(String Term, String CourseID) in c:\inetpub\ClassCancellation\mobilepage.aspx.cs:158
   mobilepage.CreateDataSource() in c:\inetpub\ClassCancellation\mobilepage.aspx.cs:70
   mobilepage.Page_Load(Object sender, EventArgs e) in c:\inetpub\ClassCancellation\mobilepage.aspx.cs:22
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0