Actually I have followed the tutorial on how to managing the website based on user's role.
My question is that, during development I will test the website using local server. When I deploy the website on a real server, do I need to configure the role on the real server like what I did on local server?
do I need to configure the role on the real server like what I did on local server?
If the roles are in the database you can simply migrate it to your hosted database. Another trick is to programmatically add the roles in the Application_Start event. Of course check first if they're not already in there. If not then you can add them through
code.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
there is no longer requiring using Aspnetdb.mdf anymore
Why not? Of course if that's the place where your RoleProvider, by default, looks for the roles associtated with the users. What I suggested was to add the roles to the database via the provider in the Application_Start if they're not yet there.
Wen Hao Mui
Member
1 Points
18 Posts
Managing website using role
Apr 30, 2012 06:18 AM|LINK
Actually I have followed the tutorial on how to managing the website based on user's role.
My question is that, during development I will test the website using local server. When I deploy the website on a real server, do I need to configure the role on the real server like what I did on local server?
XIII
All-Star
182787 Points
23484 Posts
ASPInsiders
Moderator
MVP
Re: Managing website using role
Apr 30, 2012 06:22 AM|LINK
Hi,
If the roles are in the database you can simply migrate it to your hosted database. Another trick is to programmatically add the roles in the Application_Start event. Of course check first if they're not already in there. If not then you can add them through code.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Wen Hao Mui
Member
1 Points
18 Posts
Re: Managing website using role
Apr 30, 2012 07:01 AM|LINK
If I add roles in the Application_Start event, then there is no longer requiring using Aspnetdb.mdf anymore?
Does the roles I add in Application_Start event will save in server memory?
How about the user that login ? how can I differentiate the roles of the logged in user?
nilsan
All-Star
17526 Points
3823 Posts
Re: Managing website using role
Apr 30, 2012 07:07 AM|LINK
As Kris, pointed out : If the roles are in the database you can simply migrate it to your hosted database. That will do the trick.
Blog | Get your forum question answered | Microsoft Community Contributor 2011
Wen Hao Mui
Member
1 Points
18 Posts
Re: Managing website using role
Apr 30, 2012 07:11 AM|LINK
Currently, I create the user using asp.net website administartor tool manually.
Can I do it programmatically?
Wen Hao Mui
Member
1 Points
18 Posts
Re: Managing website using role
Apr 30, 2012 07:16 AM|LINK
Ok, I got it on how to create membership throught the following tutorial:
http://msdn.microsoft.com/en-us/library/system.web.security.membership.createuser.aspx
http://msdn.microsoft.com/en-us/library/system.web.security.membershipcreatestatus.aspx
but, my last question, how to integrate the database to the hosted database?
nilsan
All-Star
17526 Points
3823 Posts
Re: Managing website using role
Apr 30, 2012 07:22 AM|LINK
Ok, roles will already be in database that you might have created using administrator tool.
I hope you must be having an interface in your application where user can register themselves and it will be saved in database.
Just then deploy your db to host environment.
Please go through below link :
http://www.4guysfromrolla.com/articles/120705-1.aspx
Blog | Get your forum question answered | Microsoft Community Contributor 2011
XIII
All-Star
182787 Points
23484 Posts
ASPInsiders
Moderator
MVP
Re: Managing website using role
Apr 30, 2012 02:46 PM|LINK
Hi,
Why not? Of course if that's the place where your RoleProvider, by default, looks for the roles associtated with the users. What I suggested was to add the roles to the database via the provider in the Application_Start if they're not yet there.
Make use of the Roles.RoleExists and Roles.CreateRole methods.
If you don't want to have two databases then there's a good way to have the aspnetdb.mdf database integrated into your own: Create Membership tables in another database than the standard aspnetdb.mdf.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!