Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Membership/roles help

Reply
Thread Tools

Membership/roles help

 
 
John
Guest
Posts: n/a
 
      08-28-2006
Hi

I have looked in help but am not clear how to do the following in vb.net
code.

1. Check if a user belongs to a specific role.

2. Change user's password. Is it possible to do it without knowing the
old/existing password?

Would appreciate if someone could give me some pointers.

Thanks

Regards


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      08-28-2006
Hi John,

> 1. Check if a user belongs to a specific role.


Label1.Text = "Is JackieReeve an Elite Member?:" &
Roles.IsUserInRole("JackieReeve", "EliteMember").ToString

http://msdn2.microsoft.com/en-us/lib...serinrole.aspx

> 2. Change user's password. Is it possible to do it without knowing the
> old/existing password?


Label2.Text = mbrCurrentMember.ResetPassword("Beatles")

http://msdn2.microsoft.com/en-us/library/d94bdzz2.aspx

Full code below.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim mbrCurrentMember As System.Web.Security.MembershipUser
mbrCurrentMember = Membership.GetUser("JackieReeve", True)
Label1.Text = "Is JackieReeve an Elite Member?:" & _
Roles.IsUserInRole("JackieReeve", "EliteMember").ToString
If Membership.EnablePasswordReset = True Then
Label2.Text = mbrCurrentMember.ResetPassword("Beatles")
Else
Label2.Text = "Password reset not allowed."
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Membership password reset</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:label id="Label1" runat="server" font-bold="True"
font-size="X-Large" text="Updating Members"></asp:label><br />
<br />
<asp:label id="Label2" runat="server"
font-size="X-Large"></asp:label><br />
<br />
</div>
</form>
</body>
</html>



"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have looked in help but am not clear how to do the following in vb.net
> code.
>


>


>
> Would appreciate if someone could give me some pointers.
>
> Thanks
>
> Regards
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments