Question

within my asp.net vb web application i have a form that displays data in various text fields. I want to place an if statement on the following code that will check if the logged in username is "TUSER", if so, place "TEST2" into the text field. For all other users, place "TEST" into the text field.

txtReportTo.Text = _
                      "TEST"

Im currently using aspnet membership to manage users. any code guidance would be great. thanks.

Was it helpful?

Solution

Dim user = Membership.GetUser()
If user IsNot Nothing Then
    If user.UserName = "TUSER" Then
        txtReportTo.Text = "TEST2"
    Else
        txtReportTo.Text = "TEST"
    End If
End If

http://msdn.microsoft.com/en-us/library/fcxcb339.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top