Managing website using rolehttp://forums.asp.net/t/1798325.aspx/1?Managing+website+using+roleMon, 30 Apr 2012 14:46:41 -040017983254957515http://forums.asp.net/p/1798325/4957515.aspx/1?Managing+website+using+roleManaging website using role <p>Actually I have followed the tutorial on how to managing the website based on user's role.</p> <p>My question is that, during development I will test the website using local server. When I deploy the website on a &nbsp;real server, do I need to configure &nbsp;the role on the real server like what I did on local server?</p> 2012-04-30T06:18:52-04:004957525http://forums.asp.net/p/1798325/4957525.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p>Hi,</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Wen Hao Mui</h4> do I need to configure &nbsp;the role on the real server like what I did on local server?</blockquote> <p></p> <p>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.</p> <p>Grz, Kris.</p> 2012-04-30T06:22:18-04:004957601http://forums.asp.net/p/1798325/4957601.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p>If I add roles in the Application_Start event, then there is no longer requiring using&nbsp;<span>Aspnetdb.mdf anymore?</span></p> <p><span>Does the roles I add in Application_Start event will save in server memory?</span></p> <p><span>How about the user that login ? how can I differentiate the roles of the logged in user?</span></p> 2012-04-30T07:01:07-04:004957616http://forums.asp.net/p/1798325/4957616.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p>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.</p> 2012-04-30T07:07:47-04:004957625http://forums.asp.net/p/1798325/4957625.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p>Currently, I create the user using asp.net website administartor tool manually.</p> <p>Can I do it programmatically?</p> 2012-04-30T07:11:16-04:004957635http://forums.asp.net/p/1798325/4957635.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p>Ok, I got it on how to create membership throught the following tutorial:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.security.membership.createuser.aspx">http://msdn.microsoft.com/en-us/library/system.web.security.membership.createuser.aspx</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.security.membershipcreatestatus.aspx">http://msdn.microsoft.com/en-us/library/system.web.security.membershipcreatestatus.aspx</a></p> <p>but, my last question, how to integrate the database to the hosted database?</p> <p></p> 2012-04-30T07:16:12-04:004957648http://forums.asp.net/p/1798325/4957648.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Wen Hao Mui</h4> Currently, I create the user using asp.net website administartor tool manually.</blockquote> <p></p> <p>Ok, roles will already be in database that you might have created using administrator tool.</p> <p>I hope&nbsp;you must be having an interface in your application where user can register themselves and it will be saved in database.</p> <p>Just then deploy your db to host environment. &nbsp;<br> <br> Please go through below link :</p> <p><a href="http://www.4guysfromrolla.com/articles/120705-1.aspx" target="_blank">http://www.4guysfromrolla.com/articles/120705-1.aspx</a></p> 2012-04-30T07:22:04-04:004958422http://forums.asp.net/p/1798325/4958422.aspx/1?Re+Managing+website+using+roleRe: Managing website using role <p>Hi,</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Wen Hao Mui</h4> there is no longer requiring using&nbsp;<span>Aspnetdb.mdf anymore</span></blockquote> <p></p> <p>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.</p> <p>Make use of the <a href="http://msdn.microsoft.com/en-us/library/system.web.security.roles.roleexists.aspx" target="_blank"> Roles.RoleExists</a> and <a href="http://msdn.microsoft.com/en-us/library/system.web.security.roles.createrole.aspx" target="_blank"> Roles.CreateRole</a> methods.</p> <p>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: <a href="http://blog.krisvandermast.com/CreateMembershipTablesInAnotherDatabaseThanTheStandardAspnetdbmdf.aspx" rel="bookmark" target="_blank"> Create Membership tables in another database than the standard aspnetdb.mdf</a>.</p> <p>Grz, Kris.</p> 2012-04-30T14:46:41-04:00