Server Error in '/' Application.

StartIndex cannot be less than zero.
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 less than zero.
Parameter name: startIndex

Source Error:


Line 244:        else if (url.Contains("/news/") || url.Contains("/tintuc/"))
Line 245:        {
Line 246:            Querystring = url.Substring(url.IndexOf(Application["Tintuc"].ToString().ToLower()), url.Length - url.IndexOf(Application["Tintuc"].ToString().ToLower())).Replace(Application["Tintuc"].ToString().ToLower() + "/", "");
Line 247:
Line 248:            if (Querystring.IndexOf("/") > 0)

Source File: c:\inetpub\vhosts\greenage.vn\httpdocs\Global.asax    Line: 246

Stack Trace:


[ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex]
   System.String.Substring(Int32 startIndex, Int32 length) +14599087
   ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in c:\inetpub\vhosts\greenage.vn\httpdocs\Global.asax:246
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93


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