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 29: 
Line 30: 		string id = Request.QueryString["sess"].ToString();
Line 31: 						string cat = id.Substring(0, id.IndexOf("["));
Line 32:         //string session = id.Substring(0, id.IndexOf("]")) ;
Line 33:         string sess = id.Substring(id.LastIndexOf(" ") + 2);

Source File: g:\pleskvhosts\ngpeducare.com\vgcmandi.co.in\gallery_category.aspx.cs    Line: 31

Stack Trace:


[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +13148884
   gallery.bindpkg() in g:\pleskvhosts\ngpeducare.com\vgcmandi.co.in\gallery_category.aspx.cs:31
   gallery.Page_Load(Object sender, EventArgs e) in g:\pleskvhosts\ngpeducare.com\vgcmandi.co.in\gallery_category.aspx.cs:13
   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.4700.0