473,795 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1213
Hi John,
1. Check if a user belongs to a specific role.
Label1.Text = "Is JackieReeve an Elite Member?:" &
Roles.IsUserInR ole("JackieReev e", "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 = mbrCurrentMembe r.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.dt d">

<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, ByVal e As System.EventArg s)
Dim mbrCurrentMembe r As System.Web.Secu rity.Membership User
mbrCurrentMembe r = Membership.GetU ser("JackieReev e", True)
Label1.Text = "Is JackieReeve an Elite Member?:" & _
Roles.IsUserInR ole("JackieReev e", "EliteMember"). ToString
If Membership.Enab lePasswordReset = True Then
Label2.Text = mbrCurrentMembe r.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>Membersh ip 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.in fovis.co.ukwrot e in message
news:OL******** ******@TK2MSFTN GP05.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
2082
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 GridView1_RowDataBound eventhandler I'm getting the user role for each user (each user will only have and
0
1009
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 the default App_Data\ASPNETDB.MDF file. I've got two boxes, one with XP & VS2005 and the other is windows 2003 with IIS 6.0, ASP.NET 2.0 & SQL Server 2005 (Not SQL 2005 Express). My app simply has one user called 'administrator' assigned with...
6
1900
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 log in become log on, but when I access the protected page, it still prompt me for log in. Please help! I am using SQL to store the membership, the code in web.config is as follow, <roleManager enabled="true"/>
5
1666
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 of the membership thing, or how are they tied together? Thanks
4
3275
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 published on the public, third-party hosted site. So I need to be able to configure access through a new section of the site, available only to admins/developers, which I'm about to write. First off, I want to create a role in the database to...
2
1660
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 of articles utilizing the built in profile classes in ASP.NET. In my mind this seems to be an easy way for to get membership working in an application. When building a commercial application, would this still be the standard way to build a web...
3
2184
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 projects, and have different roles per project. The current model.. * When a user joins my site, they eventually end up joining or creating one or more projects. But, they are not required to be a member of a project to be a member of the site.
1
2948
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 deployed the application to a production server. My Question: How do I create the initial Admin role and user in the clean/unpopulated database that has the Membership and Role schema on this production server?
3
1788
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 user a unique customerid. All users beloning to the same custeromid would see the same information on the website. Can I easily do this using membership services or must I use a combination of membership services and profiles?
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.