473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Membership/roles help

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
Aug 28 '06 #1
1 1193
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" <Jo**@nospam.infovis.co.ukwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
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


Aug 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ferherra | last post by:
Hi, Hope someone can help... I databind my gridview (asp.net 2.0) like this: GridView1.DataSource = Membership.GetAllUsers(); (MembershipUserCollection) GridView1.DataBind(); In the...
0
by: Jack | last post by:
Hello, I need some help in getting my simple web app to work. I can't seem to get the configuration of the Membership/Roles working by pointing my website to a SQL 2005 database as opposed to...
6
by: Scatir | last post by:
Hi, I have a membership problem I couldn't resolve. I have set up membership as most of tutorial instructed, and I am able to log on, but cannot stay log on for some reason. ex: when I log on, the...
5
by: JP.Gantlin | last post by:
I want to have a login page where the new user self-registers, giving some simple info like Real Estate Agent #. Do I need to used the membershiop/roles thing, or profiles? Are profiles part...
4
by: AC | last post by:
Hi there. My asp.net 2.0 development website uses roles to control access to sections of my site, configured using the asp.net configuration tool, which is great. Except that isn't available once...
2
by: StinkyDuck | last post by:
Hello, I am relatively new to ASP.NET 2.0 and have been reading a book and going through some articles on the internet. When looking for information regarding membership and roles, I see lots...
3
by: Glenn | last post by:
My current classic-ASP site has users, projects, roles and the 2.0 membership looks like a perfect fit, but I'm having trouble finding examples of how to have users that belong to different...
1
by: =?Utf-8?B?aGZkZXY=?= | last post by:
Hello, I have a web application that makes use of the SQL Membership and Role providers. My app has admin screens to manage users (membership), roles, and supplementary user data. I have just...
3
by: dm3281 | last post by:
Hello -- I need to write an ASP.NET 2.0 application for our clients to use to login and verify file transmissions. Each client will need their own logon, in addition to a way to assign each...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.