When running an application a web page I get following error:
Index was outside the bounds of the array.
[IndexOutOfRangeException: Index was outside the bounds of the array.]
Default_aspx.Page_Load(Object sender, EventArgs e) +422
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
ViewState("InitialSort1") = Boolean.TrueString = True
button2.Visible = False
Calendar1.Visible = False
TextBox1.Text = Session("Saved_JobNumber")
TextBox2.Text = Session("Saved_Text")
Else
ViewState("@User_Id") = UCase(Request.ServerVariables("LOGON_USER")).Split("\")(1)
End If
End Sub
Now, this works on my local machine, but not when published to the web server. If I remove/comment out following line:
ViewState("@User_Id") = UCase(Request.ServerVariables("LOGON_USER")).Split ("\")(1)
it works fine.