Code for QLD UserGroup Meeting July 26th


I am one of the worst when it comes to posting their code for demos -and as a result i try to stay away from demos that require code<g>


In this case not only am i posting my code- I am doing it BEFORE the presentation!


BTW For QLD folks i will be walking through the Membership Services, Role Services, Login Controls and Web Parts tonight


http://www.qmsdnug.org/


If you want to come along please rsvp by email to greg@qmsdnug.org (to help with pizza ordering)


Also if you are trying to setup the SMTP Mail be sure and see the following thread on how to get this set up:


http://www.mcse.ms/message1614187.html


 


Chuck


 


 


Protected Sub CreatUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserlnk.Click


Dim st As New Web.Security.MembershipCreateStatus


Web.Security.Membership.CreateUser(UserName.Text, pwd.Text, email.Text, “pets?”, “yes”, True, st)


CreateUserlnk.Text = st.ToString


End Sub


Protected Sub ValidateUserlnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ValidateUserlnk.Click


ValidateUserlnk.Text = Web.Security.Membership.ValidateUser(UserName.Text, pwd.Text).ToString


End Sub


Protected Sub GetUserlnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles GetUserlnk.Click


Dim usr As MembershipUser = Membership.GetUser()


GetUserlnk.Text = usr.UserName


End Sub


Protected Sub Suspendlnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Suspendlnk.Click


Dim usr As MembershipUser = Membership.GetUser()


Suspendlnk.Text = usr.IsApproved.ToString


usr.IsApproved = False


Membership.UpdateUser(usr)


End Sub


Protected Sub Createrolelnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateRoleLnk.Click


Web.Security.Roles.CreateRole(rolename.Text)


End Sub


Protected Sub AddUserLnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Adduserlnk.Click


Web.Security.Roles.AddUserToRole(UserName.Text, rolename.Text)


End Sub


Protected Sub Getuserinrolelnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton13.Click


Dim rls() As String = Web.Security.Roles.GetUsersInRole(rolename.Text)


LinkButton13.Text = rls(0).ToString()


End Sub


Protected Sub LinkButton12_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Getroleslnk.Click


Dim str As String()


str = Web.Security.Roles.GetRolesForUser(UserName.Text)


Getroleslnk.Text = str(0)


End Sub


Protected Sub LinkButton15_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles inrolelnk.Click


inrolelnk.Text = Web.Security.Roles.IsUserInRole(UserName.Text, rolename.Text).ToString


End Sub


Protected Sub DeleteUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DeleteUserLnk.Click


Web.Security.Membership.DeleteUser(UserName.Text)


End Sub



Protected Sub Loginlnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Loginlnk.Click


Web.Security.FormsAuthentication.RedirectFromLoginPage(UserName.Text, True)


End Sub


Comments (0)

Skip to main content