I am trying to compare a session variable to another string so that i can enable or disable image buttons. i am using asp.net vb with a sql2005 express backend
i was using string.compare to compare the session variable sent from the login page to a string i set to "medev" which is a username in my database, if the condition is true and username "medev" is found i would like to dissable some image buttons. can someone show me how to fix my code or a way to do this? thanks!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim string1 As String
Dim string2 As String
Label1.Text = Session("Username")
Label2.Text = Session("UserId")
string1 = Session("Username")
string2 = "medev"
If String.Compare(string1, string2, StringComparison.InvariantCultureIgnoreCase) < > 0 Then
ImageButton1.Enabled = False
MsgBox("Retrieved variable from masterpage is: " & Session("Username"))
End If