Server Error in '/' Application.

Index and count must refer to a location within the string.
Parameter name: count

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 count must refer to a location within the string.
Parameter name: count

Source Error:


Line 1007:            if (Convert.ToBoolean(HFCORSOONLINE) && titolo.ToLower().Contains("corso-on-line"))
Line 1008:            { title = titolo.Remove(titolo.LastIndexOf("--")).Replace("-", " ").Remove(0, "corso-on-line".Length); }
Line 1009:            else { title = titolo.Remove(titolo.LastIndexOf("--")).Replace("-", " ").Remove(0, 6); }
Line 1010:            if (titolo.ToLower().EndsWith("napoli-salerno"))
Line 1011:            {

Source File: d:\inetpub\webs\scuolesinet\Corso.aspx.cs    Line: 1009

Stack Trace:


[ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count]
   System.String.Remove(Int32 startIndex, Int32 count) +0
   Corso.PopulateView3(String titolo) in d:\inetpub\webs\scuolesinet\Corso.aspx.cs:1009
   Corso.Page_Load(Object sender, EventArgs e) in d:\inetpub\webs\scuolesinet\Corso.aspx.cs:3167
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.9174; ASP.NET Version:2.0.50727.9175