Membership and Role Management - problem with reading roles and users from SQL database

Hello,

I've configured SQL server 2005 as my back-end data store via aspnet_regsql.exe. I presume it was succesvol. Creating users en roles programmatically is no problem. When I start the Web Site Administration Tool I can see the created users and roles. But when I want to show them by code I get an empty result.
...
... Roles.GetAllRoles()
...
... membership.GetAllUsers()

The roleManager is enabled in web.config.

<roleManager defaultProvider="SqlProvider" 
		enabled="true" 
		cacheRolesInCookie="true"
		cookieName=".ASPROLES"
		cookieTimeout="30"
		cookiePath="/"
		cookieRequireSSL="false"
		cookieSlidingExpiration="true"
		cookieProtection="All" >
		<providers>
			<clear />
			<add name="SqlProvider"
			  type="System.Web.Security.SqlRoleProvider"
			  connectionStringName="LocalSqlServer"
			  applicationName="/" />
		</providers>
	</roleManager>

Can someone give me advice about this problem?

Friendly greetings,
Pieter

0
Pieter
5/12/2006 4:48:50 PM
asp.net.security 27051 articles. 1 followers. Follow

2 Replies
899 Views

Similar Articles

[PageSpeed] 25
Get it on Google Play
Get it on Apple App Store

Can you show me your connection string LocalSqlServer? I think you may not configure your provider properly.

Since by default, asp.net use sql express instead of sql server, you have to modify the connection string in web.config to connect your own database (SQL 2000/2005). Like this:

<configuration>

 

    <connectionStrings>

        <remove name=”LocalSqlServer”/>

        <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=appservicesdb;Integrated Security=True" providerName="System.Data.SqlClient"/>

    </connectionStrings>

 

</configuration>

 

I am afraid your app are still connecting the sql express while you have configured some roles and users in the SQL Server.

0
zhuhua1006
5/15/2006 2:12:48 AM
Hello,
Hereby my connectionStrings.
<connectionStrings>
   <remove name="LocalSqlServer" />
   <add name="LocalSqlServer" connectionString="data source=NET\NET;Initial Catalog=Tekstbank;User ID=adminTekstbank;Password=*****"
    providerName="System.Data.SqlClient" />    <add name="TekstbankConnectionString" connectionString="Data Source=NET\NET;Initial Catalog=Tekstbank;User ID=adminTekstbank;Password=*****"    providerName="System.Data.SqlClient" /> </connectionStrings>
Friendly greetings,
Pieter
 
0
Pieter
5/15/2006 11:35:47 AM
Reply:

Similar Artilces:

Manage Users For This Role / Manage Roles For This User Question
In the roles/user management pages there is a link called Manage Users For This Role and Manage Roles For This User respectively. I want non Admins to be able to see these pages, and currently I have it so that they can see the manage users and manage roles pages. However, when a non admin clicks on Manage Users For This Role or Manage Roles For This User link it does not display the control, just an empty page. I can get around this by giving edit rights to the page, but I do not want them to have edit rights for the page. Any ideas? Thanks  ...

using external SQL database for ALL membership management elements (membership, roles, profiles)
Greetings!  For the last few days I have been learning the ASP.NET 2.0 membership provider system.  After a few stumbles I believe I have everything working using my external SQL database.  I was hoping that somebody could look at my web.config below to tell if this is the best way.  Really I am wondering if there isn't an easier way to have all three elements of the membership system use the external database.  Here is what I have done: .. non-relevant areas removed for brevity ..        <membership defaultProvider="CustomizedPr...

Roles, roles, roles
Hey is it posible o have a role for a user to only update the content? I don't want that user to change skins or to make other admin changes... up I think if you allow a role to edit contents on a module level he wont be able to change anything else. Did you try that? cheers, erikErik van Ballegoij, The Netherlands if you allow a role to edit contents in a module lets say discussions module, then that role will be able to edit, delete the threads. so for a role to be able to add new thread only, do we need to write our own code?-keeara g------------------ keeara, see...

Duplicate Security Roles Showing up In Security Roles Manager
Anyone have any ideas?  We have had and instance of 3.0.13 with one child portal running for about a month now.  A few days ago our adminstrator noticed that we have duplicate entries for security roles. For example, the Security Roles Manager shows:Name Description Fee Every Period Trial Every Period Public Auto   Administrators Portal Administration         False False   Administrators Portal Administration         False False  Registered Users Registered Users    &n...

How do I configure my own SQL Server database for membership profile and role management.
 Hi I don't want to use ASPNETDB database (default one) for membership and role seervices. I want to configure my own database. How do I do that? Hi, please take a look at this article: Create Membership tables in another database than the standard aspnetdb.mdf. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons.  Wow...Thats cool....Thanks for the info.... if we double click on aspnet_regsql.exe it will open a wizard, through which we can configure it .... Amazing.....Thank you very much ...

Membership & Role Management using Sql Database type
I am doing Membership and role management in ASP.net Whidbey. In the security setup wizard I would like to use SQL Server database type. If I select Mixed (Sql Server Authentication mode). I end up with the following message. “The following message may help in understanding the problem: Exception in configuration section handler.” My web.config file looks like this <system.web> <membership> <providers /> </membership> <compilation debug="true"/> <authentication> <forms> <credentials /> ...

Sending email to all users in Membership database / all users by role.
I am trying to send emails to ALL users in the membership database.  Right now i am using this VB code to send an email in a web form.   Can anyone help me with the code to send this message in the web form to everyone in my membership database? Or to all users in the database assigned to a specific ROLE? (Actually that would be better).   Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendEmail.Click Const ToAddress As String = "xxxj@xxxx.com,xxxx@xxxx.com,xxx@xxx.com" Dim mm As New MailMessage(UsersEmail.Text, ToAddress) ...

Creating User Account Without Default Security Role (Registered User Role)
  My DNN version is 3.1.1. The portal is set to Private Registration. Unauthenicated users have access to the basic pages of the site. We require my company's current customers to register and be approved to have access to all other pages that contain information restricted to them (the major part of the site). As you know, authorizing a user account applys the Registered User security role by default and this is how I control access to the customer areas.  We want to create a page that will be used by Marketing to allow potential customers by login to...

Membership and Roles
Hi all, Is there a way to allow the user choose a role from a selection you provide them with? e.g. I have 3 types of users: admin, contractor, and landlord. Of course I don't want them to be able to assign themselves admin role, so how would I proceed? (I'm using C# by the way) This is what I have so far. Please note "Roles...();" is where I am stuck: -within my aspx page i have: <asp:WizardStep ID="CreateUserWizardStep2" runat="server" Title="Contractor or Landlord?"> <asp:ListBox ID="ListBox1" runat=&q...

role management with membership security
Module Edit List View Import Accounts None Owned All All HR None Owned All All Sales None Owned All All Finance None Owned All All Normal 0 MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; ...

Security Roles and User management
I have a question concerning Sercurity roles in 2.0 beta 3. I noticed that I am unable to delete the registered security role from user profiles where as I was able to do this in 1.x will this be the same in the final release? I ask because I would really like to set up 3 security roles just like I currently have in 1.x: Public - no rights other then read ony Registered - allowed to make content changes but not move modules or add users and such Admin - full control Will this be possibe in 2.0? This is kind of a criticle issue for us as we are going to be using DotNetNuke f...

Manage roles using Windows auth and SQL roles?
Hi, I am hoping someone can help me with this.  I am VERY new to ASP.NET and VB.NET and have been thrown into the deep end in designing a web application.  The app is using Windows authentication and SQL roles.  That is working fine.  However, I need to create an interface that allows for user role management.   I have looked at ScottGu's "Implementing Role-Based Security with ASP.NET 2.0 using Windows Authentication and SQL Server" and he shows a very basic role administration interface.  I got that working, but the problem is that our AD h...

AD users into SQL Membership/Roles
I know someone's thought of this before.  I'm working with an AD domain and what I would like to do is be able to add users from the AD domain to various roles I have created for my app.  Ideally, sql would completely manage the roles and memberships but not the user accounts -- basically check to see if they're an admin/office staff and give them extra links to play with. Ideas? Maybe you can use the active directory membership provider http://msdn2.microsoft.com/en-us/library/system.web.security.activedirectorymembershipprovider.aspxSilverlight-helpVb TipsSpace Coast .Net...

Manage users and roles for users
Hi. I want to know how can i manage my users and users roles on my hosted website. I want that admin controls (when i log in as admin) allow me to change users roles and other stuff. Any1 have any guide or know any website that teach how to create a "admin.aspx" page to manage users and roles? thx Do you have the schema ready ? If yes, are you willing to change the schema ? Are you using ASP.NET 2.0 ? If yes, you can easily do this using the administration tool in ASP.NET 2.0.                 &n...

Use existing databases for membership/role management
Hello,  How can we use our existing databases containing users, roles ... in a new asp.net website? Do we have to implement a new MembershipProvider from scratch? Our users are stored in a mssql server...   thanks and greets from germany Dirk found the answer myself, just after writing :) http://msdn2.microsoft.com/en-us/library/f1kyba5e.aspx   can be closed....

Web resources about - Membership and Role Management - problem with reading roles and users from SQL database - asp.net.security

Polish European Union membership referendum, 2003 - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Drivers of Facebook Shuttle Buses Eye Teamsters Membership
Facebook and several other tech companies in Silicon Valley provide shuttle buses to transport their employees, and according to The New York ...

NJ Membership (@NJMembership) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Membership Has Its Privileges
Right now, crossing one of the magical rep borders happens more or less unnoticed. People just gain the particular powers. Now, of course they ...

Membership Cards - a set on Flickr
... home Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Membership ...

Calgary Public Library: New Look. New Library. Free Membership. - YouTube
CREATING THE WORLD’S BEST PUBLIC LIBRARY: NEW LOOK. NEW LIBRARY. FREE MEMBERSHIP. For Immediate Release: In a bold move to become the world’s ...

The benefits of private club membership in the UAE
Lifestyle membership clubs can offer cardholders exclusive leisure discounts across the Emirates. But there can be a big catch - you need to ...

New Brisbane Broncos CEO Paul White Flags Membership Drive
The coal executive taking over at the helm of the Brisbane Broncos has his eyes set on the thousands of fans who regularly turn up to home games ...

Joe Tripodi's ALP membership suspended
NSW ALP has suspended membership of Joe Tripodi amid a corruption inquiry.

Invite-only memberships expand at Canberra's sky-high lounge
... club &ndash; if they have been lucky enough to get an invite The 15th floor lounge billed as Canberra's most exclusive has quadrupled its membership ...

Resources last updated: 1/7/2016 7:07:31 PM