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


Similar Messages:

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 :: 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 :: 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

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

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

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

Security :: Creating Membership Provider At Runtime?

Jan 30, 2010

Sometimes MS provides error message so silly that its hard to understnad and you feel like throwing away all things.

My Web.Config does not contain any entries of MemberShip, Role or Profile.

I want to create a membership provider dynamically through code at runtime. I wrote following code and it receives following error message. I don;t know how come machine.config error appears in my application. how annoying.

Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

Source Error:

[Code]....

Source File: C:WindowsMicrosoft.NETFrameworkv2.0.50727Configmachine.config Line: 139

Following is the CODE.

[Code]....

View 22 Replies

Security :: Programmatically Changing The Profile Provider At Runtime?

Aug 25, 2010

I'm using one application but have multiple providers in my web.config for memberships, roles and profiles to allow my application to be used by different groups of users who need to connect to different databases.

This means I'm having to change the membership, role and profile providers on-the-fly in my code-behind files. So far I've taken care of the membership and roles a bit like this:

[Code]....

However, I'm having trouble finding out how to do the same sort of thing for Profiles. I've looked at ProfileProvider and ProfileManager but I can't work it out how to access my the profile property that I've created in my web.config file called "ScreenSize". Normally you would just write Profile.ScreenSize to read or write to the property.

View 12 Replies

Security :: Programmatically Setting Membership Provider At Runtime?

Jul 27, 2010

I've been using the following:

[Code]....

The error that I'm getting in Visual Studio is "Overload resolution failed because no accessible 'GetUser' accepts this number of arguments". I don't understand why it's not working.

View 2 Replies

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

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

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

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

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 :: Sql Role Provider Does Not Allow To Update The Role Name?

Mar 18, 2011

Why asp.net sql role provider does not allow to update the role name , whats its reasons.

View 5 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

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

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

VS 2008 Changing Default Database In.NET Membership Provider?

Nov 17, 2010

When i add asp.net membership provider it uses some default database to add those records?How to change the default database to my own sql database?

View 1 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

Security :: Extend The Role Provider?

Apr 29, 2010

Is it possible to extend role provider? like instead of IsUserInRole(username, rolename) can we have a IsUserInRoleFacility(username, rolename, facilityid)

View 2 Replies

Security :: Default Role Provider Could Not Be Found?

Oct 26, 2010

This is probably a lame question, but I know little of web development. I inherited a web project that I'm trying to get running locally. I get the mentioned error on line 46.

Line 44: </authentication>
Line 45: <membership defaultProvider="AD_MyCompanyName" />
Line 46: <roleManager enabled="true" defaultProvider="ADRP_MyCompanyName_Readonly" cacheRolesInCookie="true" cookieName="MyCompanyName.ROLES" createPersistentCookie="true" cookieSlidingExpiration="true" cookieTimeout="240" />
Line 47: <profile enabled="false"/>
Line 48: <customErrors mode="Off"/>

This code works on the old developer's box, but not on mine. I've been working through some TFS checkout issues on his box, assuming it was simply files left checked out. I can't figure out where the providers are added. I don't see them being added in the config file above. In fact, if I search for "AD_MyCompanyName" and "ADRP_MyCompanyName_Readonly", I get no hits in the entire solution. I can't figure out what they are. Not sure why it works on that box if I can't even find the providers being added.

View 2 Replies

Security :: Custom Role Provider Doesn't Work

May 26, 2010

I have a custom role provider and I'm trying to get the IsUserInRole() method to get called when a user of a certain role tries to access a restricted page. However, the method is never called.

[code]...

When the user goes to a restricted page, I'd like the custom role provider to check the user's role and deny/grant access.

View 3 Replies







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