smithmrk
asked on
VB.net 2013 - Windows Forms using Membership Validation
OK, this seems simple...but I can't seem to figure it out!
I'm using the AspNetSqlMembershipProvide r in my windows form...which works great to login in:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
If Membership.ValidateUser(Us ernameText Box.Text, PasswordTextBox.Text) Then
Me.Close()
frm_Lookup.Show()
Else
MessageBox.Show("Your login attempt was not successful. Please try again.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Sub
Once I open the Lookup form based on the fact that their login passed the validation...how do I get the current user name?
For example in ASP.net I can use User.Identity.Name, but what is it in Windows Forms?
Thanks,
Mark
I'm using the AspNetSqlMembershipProvide
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
If Membership.ValidateUser(Us
Me.Close()
frm_Lookup.Show()
Else
MessageBox.Show("Your login attempt was not successful. Please try again.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Sub
Once I open the Lookup form based on the fact that their login passed the validation...how do I get the current user name?
For example in ASP.net I can use User.Identity.Name, but what is it in Windows Forms?
Thanks,
Mark
ASKER
I tried this:
Thread.CurrentPrincipal.Id entity.Nam e
and it picks up my laptop domain user name...NOT the SQL ASP Membership Provider user name.
I log into my companies domain...however the database (Membership Provider) that I use for my application is different and I'm NOT picking up those user names from: Thread.CurrentPrincipal.Id entity.Nam e
Thanks,
Mark
Thread.CurrentPrincipal.Id
and it picks up my laptop domain user name...NOT the SQL ASP Membership Provider user name.
I log into my companies domain...however the database (Membership Provider) that I use for my application is different and I'm NOT picking up those user names from: Thread.CurrentPrincipal.Id
Thanks,
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, I was just hoping I could access it the same way I do with ASP.net.
Thanks,
Mark
Thanks,
Mark
try this
Open in new window
Open in new window