Server Error in '/' Application.

Length cannot be less than zero.
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: Length cannot be less than zero.
Parameter name: length

Source Error:


Line 282:    {
Line 283:        string _tipoContratto = categoria.Substring(categoria.LastIndexOf(' ') + 1, categoria.Length - categoria.LastIndexOf(' ') - 1).Substring(0, 2).ToUpper();
Line 284:        string _categoria = categoria.Substring(0, categoria.LastIndexOf(' '));
Line 285:
Line 286:        return string.Format("<root><categoria>{0}</categoria><tipoContratto>{1}</tipoContratto></root>", _categoria, _tipoContratto);

Source File: e:\webroot\ziantoni\App_Code\ProxyWS.cs    Line: 284

Stack Trace:


[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +12951568
   ProxyWS.SplitCategoria(String categoria) in e:\webroot\ziantoni\App_Code\ProxyWS.cs:284
   ProxyWS.Get_Lista_Area_Full(String tipoTabella, String categoriaComposta, String idComune, String area, String tipologia, String prezzoMin, String prezzoMax, String superficieMin, String superficieMax, String locali, Int32 take, String opzioniWeb) in e:\webroot\ziantoni\App_Code\ProxyWS.cs:469
   selezione_immobili_map.AvviaRicerca(String tipoTabella, String categoria, String comune, String area, String tipologie, String prezzoMin, String prezzoMax, String superficieMin, String superficieMax, String locali, String listType) in e:\webroot\ziantoni\re\selezione-immobili-map.aspx.cs:366
   selezione_immobili_map.Page_Load(Object sender, EventArgs e) in e:\webroot\ziantoni\re\selezione-immobili-map.aspx.cs:238
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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