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 41:         {
Line 42:             string codAnuncio = endereco.Replace(".aspx", "").Substring(endereco.LastIndexOf("/") + 1);
Line 43:             codAnuncio = codAnuncio.Remove(codAnuncio.IndexOf("."));
Line 44:             Context.RewritePath("~/banner.aspx?cod=" + codAnuncio);
Line 45:         }

Source File: d:\inetpub\wwwroot\msleiloeira\Global.asax    Line: 43

Stack Trace:


[ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex]
   System.String.Remove(Int32 startIndex) +14414523
   ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in d:\inetpub\wwwroot\msleiloeira\Global.asax:43
   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.4700.0