MVC :: Custom Membership / Role Provider Works But Seems Unable To Determine User Roles

Apr 26, 2010

I created a custom forms authentication and membership provider and it seems to work fine opening up in WAT, creating roles and adding users. Also when I in my mvc app use it to log users in, it works fine. However it seems to fail to determine a user's role (no errors, but just jump over User.IsInRole(...) lines and Roles.GetRolesForUser(); comes up empty. I got a gut feeling I did something wrong with my configuration, so for now I'll post just that:

[Code]....

View 6 Replies


Similar Messages:

Security :: Custom SQL Server Membership - User And Role Provider With Aspnet_regsql Generated DB Schema?

May 26, 2010

I am trying to create a Forms Authenticated site and have already used the aspnet_regsql tool to create the necessary logic in my SQL Server DB to hold my data. Now, I am looking to create a custom Membership, User and Role provider for my DB model. I was looking at the following video: [URL]

Now, I get the concept on how to go about it but I notice that this guy uses custom DB Procedures as to the ones that are generated by the aspnet_regsql tool. Can anyone direct me on where I can find info on how to go about building the Membership, User and Role provider class using the DB structure that aspnet_regsql generates? So much junk on google that I am having a hard time finding good guidance.

View 1 Replies

VS 2008 Implement Custom Role Provider And Membership Provider

Sep 27, 2010

I have watched the how to video on Creating a Custom Membership provider. So far it works great. My login control interacts well with it etc. Now i've created a Custom Role Provider. I've created a class that inherits the RoleProvider base class and i've added code to each Sub. My question is, what is the best way to implement the role provider, considering I get the Roles etc from the database?

View 11 Replies

Security :: Implement custom Role Provider And Membership Provider?

Dec 1, 2010

i have implemented custom role provider and membership provider .

login page : SignIn.aspx

on successful login it redirects to (index-Homepage.aspx)

now PROBLEM is when it successfully logged in ,and redirects to 'index-Homepage.aspx' it gives Anornymoustemplate ..while its verifying the role correctly in index-Homepage.aspx.cs

View 1 Replies

.net - Implement A Custom Role Provider Which Supports Sub Roles?

Jul 28, 2010

how to implement a custom role provider which has support for parent and child roles?

I have a requirement to have high level Role permissions as per the usual Role provider functionality. However, I also have a requirement to further breakdown permissions into sub roles. I toyed with the idea of having further role instances for sub permissions but I'd prefer to have a native solution which allows for sub roles.

For instance:

[IT]
[IT] > [Admin]
[Extranet]
[Extranet] > [Admin]

In this scenario, the "Admin" role is actually 2 distinct roles, one for IT and one for Extranet scenarios. Ideally, there is no association between the 2 "Admin" roles because they are unique sub roles.

[Edit]: Following Igor's comment I feel I should clarify. The aspnetdb is already hosting multiple applications and therefore the use of the Application Name is not possible to segregate the sub roles as it is already being used to seperate the roles by application.

View 2 Replies

Security :: Can Implement Custom MembershipUser/custom Roles And Membership Provider

Oct 13, 2010

I create custom principal for implement logic for users. In identity I store Id, Name. But it abnormally - this classes must use for authenticate and authorize.

I can implement custom MembershipUser, custom Roles and Membership provider.

How to do it? What best practices are?

View 5 Replies

Security :: Implement Custom Role Membership Provider For Web App?

Apr 20, 2010

We are trying to implement Custom Role membership provider for our web app. For authorization we want to check for one more field like Facilityid for the logged on user along with role he has. eg. my User1 having Role1 with Facility1 can access some option and same user role for Facility2 have different option. So is there a way we can extend the existing role/profile provider to authorize user with this additional field along with role assigned.

View 1 Replies

Membership Role Provider Doesn't Work With Custom Connection String

Oct 18, 2010

I have Membership configured with IIS7, tables for it located in my own database, created with aspnet_regsql utility, and I am using custom connection string to access it.

This is part of web.config related to Membership :

[code]...

View 2 Replies

Security :: Creating A Interface For User Role Management Based On Built In Membership Provider?

Feb 18, 2011

I am creating a interface for User Role Management based on built in membership provider.I want to display all the roles as check boxes for a selected user. I am able to display all the roles in the database, but not able to load the specific user roles. For example, I am able to publish role 1 role 2 role3 role 4 as check boxes. But if the user is already flagged as role 1 and role 3, I am not able to show that data (role1 and 3 should be checked when form loads, but right now, they are not checked)...How do I get the roles as checked boxes display on a page.I am using a repeater control to display roles as check boxes on the page..

<asp:Repeater ID="UsersRoleList" runat="server">
<ItemTemplate>
<asp:CheckBox runat="server" ID="RoleCheckBox" AutoPostBack="true" Text='<%# Container.DataItem %>'

[code]...

View 1 Replies

Security :: Forms Authentication With AD Membership Provider And SQL Role Provider?

Jul 27, 2010

I am trying to build an application that

1. user can login by their AD account and password.

2. AD account can be assigned to different group.

I know there is a training video - [URL] to teach how to use the tool to provision the membership schema to SQL server for Forms authentication. but how can I use AD authentication with this?

View 1 Replies

Security :: Difference Between Role Provider And Membership Provider?

Dec 1, 2010

1 - whats the difference between Role Provider and Membership provider ??

2- If we implement Custom Role Provider or Custom Membership provider then what does this means ? and which Provider do we use when we apply custom role provider or custom membership provider

View 4 Replies

C# - Use Membership Provider To Set Role?

Mar 4, 2011

I am building my first asp.net app from scratch. I have two different membership providers. One is a basic sql provider while the other is active directory. The user "role" is determined by how the user logs in. I want to use the Role Manager functionality of asp.net but I don't want to build the whole role provider part when I really don't have "roles" in my application, I have two membership types.

Is there a way to set the role of the user through the membership provider at login or in some way mark a logged in user as having been authenticated by sql or AD?

This is my first asp.net app, am I even thinking about this the right way?

View 2 Replies

Web Forms :: Set Roles Without Membership And Role Providers?

Mar 10, 2010

how do i do that through config file?

View 11 Replies

Security :: Custom Membership Provider Error "Could Not Load Type Custom.AspNet.Membership.PostPropertyProvider"

Jan 5, 2011

This is my first membership provider; I converted the sample provider [URL] to SQL. I created a vb class provider and put it into the App_Code folder. After it was created I tried to modify my webconfig but the error pops up. I don't know what else to try, I don't know if I have missed something

webconfig:

[code]....

View 1 Replies

Security :: Changing The Membership / Role Provider At Runtime?

Jul 24, 2010

I started out with the following code which worked fine, no problems:

[Code]....

I've since expanded the above so that it uses different providers according to the current logged in user. Here's the code since my changes:

[Code]....

I'm not getting any error messages but when I view the web page in the browser, it is stuck in a continuous loop where the page displays (correctly), then posts back to the server and displays again.

View 1 Replies

Use Existing Sql Server Tables Along With Role And Membership Provider?

Mar 30, 2011

I have an application in Asp.net and using sql server to store user information. There is a table named dbo.member which stores user information - fname, lastname, email, phone etc. We use LDAP for authentication. The entire application works on this member table. There is a unique userid(not password) associated with each member. I installed default aspnet_membership, aspnet_role tables by running aspnet_regsql.exe utility. Now with increasing number of applications, handling members' information is becoming nightmare. I hope Membership providers will solve this problem but I have doubts.

How can I integrate existing member table with default aspnet_membership table? Or should I integrate since it is very limited? Same is the case with aspnet_Profile - it is very limited and I have stored all profile information into member table. We store more information and we want to query all that information for a user. Should I create my own provider that will use dbo.Member table instead of dbo.Membership table and also with Profile provider?

View 1 Replies

MVC :: AspNetDB Membership / Role Provider Not Working 'outside' Server?

Jul 6, 2010

I have deployed an MVC application that uses ASPNetDB for Membership and Role Provider.

now when i browse to the site on the actual server where it was deployed to i can use the login page to login on to the site and gain access to views that are restricted to users like myself by role.

However when i try and access the web application from any client computer who has access to sites on the server since the server is on the same domain - i experience the following strange behaviour:

when i navigate to my login page and enter my username and password (as stored in the aspnetdb database)

and click login

the page refreshes (looses my userid and name) and it does not go to the view i requested.

it also does not show in the top right links that i am logged on.

it is as though it spits out my username and password and refresh the page and that is that!

Why does it work on the server where the site is hosted - but not from external clients?

i can access all pages that do not require users to be logged on or haev a specific role - but cannot log on and view them since login is broken?

View 4 Replies

Security :: Big Extension Of Membership Provider - Should Use A New Custom Provider

Mar 27, 2010

i'm building an application and i need to manage roles, users and more things so i tought to use the membership provider but i have some questions about it: can i full extend it and can i override the functions to use a database table to store infos about config or i need to build my own provider?

View 4 Replies

Is There A Way To Call Custom Method Of Custom Role Provider Class

Apr 21, 2010

I have created my own custom role provider class "SGI_RoleProvider" and configured properly.

Everything is working fine.

Suppose that I have added a public method say "SayHello()", then how can i call that. Because if i am using Roles then the method is not displayed. If i am forcefully using that Roles.SayHello() then compiler gives the error.

how can i call this. Because creating a new instance of SGI_RoleProvider is meaningless.

View 1 Replies

Security :: Dynamically Selecting Membership / Role Provider At Runtime?

Jul 28, 2010

I'm building an application that will be used by a number of different schools who want completely separate databases so I've decided to have multiple connection strings and membership/role providers in my web.config file. In my code, I'm trying to set which connection string and provider to use at runtime for the correct database according to the logged in user.

I'm coming into a lot of bits in my code that previously worked fine, that now don't. For example, I used to use:

[Code]....

But now that I've changed it to this, it doesn't work anymore:

[Code]....

The compiler tells me that AddUserToRole is not a member of 'r'. I've had similar problems not just with Roles but Membership too, like with calling CreateUser.

I'd still like to be able to use all these methods that I was using before which are extremely handy. I just want to be able to set the membership/role provider at runtime rather than use the default one. Am I doing something wrong? Is there a simpler way to go about this?

View 7 Replies

Security :: Direct Access To The Page Using Role & Membership Provider?

Feb 15, 2011

I have a web app developed using role & membership provider...

this is my web.config file

<authentication mode="Forms">
<forms loginUrl="Forms/LogIn.aspx" name=".ASPXFORMSAUTH" defaultUrl="Forms/main.aspx" timeout="30"></forms>
</authentication>[code]....

So i would like that the page "pag1.aspx" is reached bypassing the "main.aspx" so If I try to digit directly on the server http://localhost/forms/pag1.aspx?C=159 ......correctly appears the login page....and the URL became..

http://localhost/Forms/LogIn.aspx?ReturnUrl=%2fForms%2fpag1.aspx%3fC%3d151&C=159 and after login I can see correctly the page1.aspx . when I try to reach the page from my browser..I digit

http://myserver/forms/pag1.aspx?C=159 .... the login page appears...but the url became..

http://myserver/Forms/main.aspx

and after login I cannot see the page1.aspx....but main.aspx

View 1 Replies

Active Directory Membership Provider Works Only For The Administrator?

Nov 2, 2010

I am pulling my hair on this one..

I have Active Directory Memebership Provider configured like this:

[code]....

The provider is instantiated correctly but when I call this:

var user = Membership.Providers["myDomain"].GetUser("myUser", false);

the call always returns null, except the case when I pass "Administrator" into the call... I have run out of ideas on how to make it work.

View 2 Replies

Configuration :: Connection String To A Remote Database For Membership And Role Provider

Jun 11, 2010

I am developing an application in which I can connect to the ASPNETDB.MDF if it is on my machine, however, when I want to put it on another machine and try to remote connect it, I get the error:

An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString and my connection string is as follows:

<add name ="NewRemoteSqlServer" connectionString="Data Source=P1M1_2-HPSQLEXPRESS; AttachDBFilename=C:ASPNETDB.MDF; Integrated Security=SSPI; Username=P1M1_2-HP; Password=plus1minus1; " providerName="System.Data.SqlClient"/>

View 5 Replies

Net SQL Membership Provider Custom Provider Property

Dec 16, 2010

<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
</properties>
</profile>

I have the code snippet above in my webconfig file. I am attempting to set the FirstName property in codebehind on a register.aspx page. Like this:

Profile.FirstName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("FirstName")).Text;

VS says Profile is in System.Web.Profile Namespace. I then use it like this "System.Web.Profile.FirstName", but says first name does not exist in System.Web.Profile.FirstName namespace.

How do I set the property and later retrieve it?

View 3 Replies

Custom Role Provider Nhibernate Error?

Jan 5, 2011

I am implementing a custom role provider in my nhibernate application I have a repository that I call whenever I want to access the nhibernate session. So when my role provider initializes itself

public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) {
base.Initialize(name, config);
Repository = new Repository();

[code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved