Server Error in '/' Application.

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

Source Error:


Line 39:             v1 = url.LastIndexOf("-")
Line 40:             v2 = url.LastIndexOf(".")
Line 41:             Dim id As String = url.Substring(v1 + 1, v2 - v1 - 1)
Line 42:             HttpContext.Current.RewritePath("~/makaleler.aspx?id=" + id, False)
Line 43:         ElseIf url.Contains("/bilgi/") Then

Source File: D:\vhosts\kemalcifci.com\httpdocs\global.asax    Line: 41

Stack Trace:


[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +13220367
   ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in D:\vhosts\kemalcifci.com\httpdocs\global.asax:41
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +71


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