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 81: k1 = Replace(str, "/محصول-", "") Line 82: p1 = Replace(k1, "-", " ") Line 83: k2 = p1.Substring(originalPath.LastIndexOf("باعنوان") - 7) Line 84: Line 85: p2 = originalPath.Replace("/محصول-" + k1, "ShowProduct.aspx?ID=" + p1.Replace(k2, "") + "&subject=" + k2)

Source File: D:\WebSites\JahanParche.ir\global.asax    Line: 83

Stack Trace:


[ArgumentOutOfRangeException: StartIndex cannot be less than zero. Parameter name: startIndex] System.String.Substring(Int32 startIndex, Int32 length) +14342511 ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in D:\WebSites\JahanParche.ir\global.asax:83 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.4110.0