Server Error in '/' Application.

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

Source Error:


Line 204:    string displayTime = "";
Line 205:
Line 206:    string wHour = wRaceTime.Substring(0, 2);
Line 207:    string wMinutes = wRaceTime.Substring(2, 2);
Line 208:    string whenTime = "AM";

Source File: g:\pleskvhosts\horsingaround.com.au\httpdocs\horsingaround.com.au\DisplayRace.cshtml    Line: 206

Stack Trace:


[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +13148947
   ASP._Page_DisplayRace_cshtml.Execute() in g:\pleskvhosts\horsingaround.com.au\httpdocs\horsingaround.com.au\DisplayRace.cshtml:206
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +131
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +116


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