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 37:                 var newstr ="";
Line 38:                 if (socialnew.description.Length > 180)
Line 39:                     newstr = Bassma.Areas.KMS.Models.Utilities.StripHtml(socialnew.description).Substring(0, 180) + "...";
Line 40:                 else
Line 41:                     newstr = Bassma.Areas.KMS.Models.Utilities.StripHtml(socialnew.description);

Source File: d:\http\bassma\bassma.org\wwwroot\Views\MediaCenter\NewsEvents.aspx    Line: 39

Stack Trace:


[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +14794056
   ASP.views_mediacenter_newsevents_aspx.__RenderContent3(HtmlTextWriter __w, Control parameterContainer) in d:\http\bassma\bassma.org\wwwroot\Views\MediaCenter\NewsEvents.aspx:39
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +117
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +79
   ASP.views_shared_home_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\http\bassma\bassma.org\wwwroot\Views\Shared\Home.Master:322
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +117
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +79
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +250
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +75
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +79
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8753


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