During local my system its working but when i uploaded it on-site i encountered problem..
Do i need some dll?
Index was outside the bounds of the array.
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Line 6: if (Request.Params["mode"] != null) Mode = Request.Params["mode"];
Line 7: if (!Path.Split('/')[3].Equals("Default.aspx") && (String)Session["accesslevel"] == ("0"))
If I had to guess I’d say it’s probably this:
If you’re running under http://localhost/myapp you’ll have more elements in the array after calling Path.Split than if you are running under http://www.myapp.com. Chances are you only have 3 elements in that array in production, not the 4 you probably have in dev.
EDIT:
For the page you posted, a call to Request.Path is going to return:
When you do a split on ‘/’, you’re only going to get back 3 elements:
That’s why
Path.Split('/')[3]will throw anIndexOutOfRangeException. So the short answer is you should switch it toPath.Split('/')[2]in production, but a better solution would be to come up with a way where the case is handled using the same code in both environments.