First line generating an exception when run at remote server. No error when running the code via IIS Express at my development notebook.
if (Session["LdapData"] == null) {
// do something
}
Exception:
[ArgumentOutOfRangeException: Der Index lag außerhalb des Bereichs. Er darf nicht negativ und kleiner als die Sammlung sein. Parametername: index] System.Collections.ArrayList.get_Item(Int32 index) +14539412 System.DirectoryServices.ResultPropertyValueCollection.get_Item(Int32 index) +93
Microsoft does it exactly the same way: https://msdn.microsoft.com/de-de/library/03sekbw5(v=vs.100).aspx
if (Session["City"] == null)
// No such value in session state; take appropriate action.
Any ideas for debugging?
Edit: Also read this articles, but didn´t get the point: