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 273:
Line 274:        url = url.Contains("?") ? url.Split('?')[0] : url;
Line 275:        string[] arrUrl = url.Remove(url.ToLower().IndexOf(".php")).Split(new char[] { '/' });
Line 276:        cityName = Convert.ToString(arrUrl[numLoop].Split(new char[] { '-' })[3]);
Line 277:

Source File: c:\inetpub\vhosts\reliablegreetings.com\httpdocs\App_Code\clsUrlRewrite.cs    Line: 275

Stack Trace:


[ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex]
   System.String.Remove(Int32 startIndex) +7211868
   clsUrlRewrite.getDetailsToCityCatPage(String& url, Int32 numLoop) in c:\inetpub\vhosts\reliablegreetings.com\httpdocs\App_Code\clsUrlRewrite.cs:275
   ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in c:\inetpub\vhosts\reliablegreetings.com\httpdocs\Global.asax:75
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +139
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +88


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