Server Error in '/' Application.

startIndex cannot be larger than length of string.
Parameter name: startIndex

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: startIndex cannot be larger than length of string.
Parameter name: startIndex

Source Error:


Line 414:        string value;
Line 415:        int length = s.Length;
Line 416:        value = s.Substring(1, length - 1);        
Line 417:        foreach (char c in value.ToCharArray())
Line 418:        {

Source File: e:\WWW\BigWalnutLocalSchoolDistrict\App_Code\CustomCrypto.cs    Line: 416

Stack Trace:


[ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex]
   System.String.Substring(Int32 startIndex, Int32 length) +13220307
   CustomCrypto.DecryptLong(String s) in e:\WWW\BigWalnutLocalSchoolDistrict\App_Code\CustomCrypto.cs:416
   protected_PrintArticle.parseCode() in e:\WWW\BigWalnutLocalSchoolDistrict\protected\PrintArticle.aspx.cs:125
   protected_PrintArticle.Page_Load(Object sender, EventArgs e) in e:\WWW\BigWalnutLocalSchoolDistrict\protected\PrintArticle.aspx.cs:39
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


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