Server Error in '/' 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 519:
Line 520:                        string chuoicuoi = lines[lines.Length - 1].Trim().ToLower();
Line 521:                        chuoicuoi = chuoicuoi.Substring(0, 2);
Line 522:                        if (chuoicuoi == "bv")
Line 523:                        {

Source File: c:\www\giaothonghanoi.com.vn\App_Code\VQS.cs    Line: 521

Stack Trace:


[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +14794088
   TTV.VQS.get_ControlCurent() in c:\www\giaothonghanoi.com.vn\App_Code\VQS.cs:521
   Site.LoadIcon_SEO() in c:\www\giaothonghanoi.com.vn\Site.master.cs:119
   Site.LoadModulesControl() in c:\www\giaothonghanoi.com.vn\Site.master.cs:246
   Site.Page_Load(Object sender, EventArgs e) in c:\www\giaothonghanoi.com.vn\Site.master.cs:100
   System.Web.UI.Control.OnLoad(EventArgs e) +106
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785


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