I have run the aspnet_regsql program to update my database for role management. There are now tables for aspnet_Applications, aspnet_Membership, aspnet_Paths, etc.
My website uses a table to store usernames, passwords and roles. These columns are populated at registration time. My goal is to redirect users at login time based on their role in Siteuser table. A user with one role may now access the folder of users of
the other role. In order to get role management to work, how do I integrate the new tables created with my existing table ? In order to use this role management, do I have to now transfer all the columns in my existing table to this membership table? Or,
is it possible to cross reference my existing table for username, password and role into these tables?
authenticated = Authentication(Login1.UserName, Login1.Password)
If authenticated Then
Dim a As Boolean = Roles.IsUserInRole(Login1.UserName, "user")
Dim b As Boolean = Roles.IsUserInRole(Login1.UserName, "processor")
Dim UserName As String = Login1.UserName
If Roles.IsUserInRole(Login1.UserName, "user") Then
Response.Redirect("~/users/Default.aspx")
ElseIf Roles.IsUserInRole(Login1.UserName, "processor") Then
Response.Redirect("~/users2/Default.aspx")
End If
FormsAuthentication.RedirectFromLoginPage
<!-- Configure the Sql Role Provider -->
<roleManager enabled ="true" defaultProvider ="SqlRoleProvider" >
<providers>
<add name ="SqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="sqlConnectionString"
applicationName="MembershipAndRoleProviderSample"/> <--what should this be pointing to in my database?
</providers>
</roleManager>
I have read some articles on role management, and I believe that I will have to create a column in my existing table with the userid created under the membership provdier. It will be of a long name with 32 digits I believe. This way I can cross reference
the membership table. i will give this a try.
Member
247 Points
1310 Posts
Role management not working
May 01, 2020 05:16 AM|sking|LINK
I have run the aspnet_regsql program to update my database for role management. There are now tables for aspnet_Applications, aspnet_Membership, aspnet_Paths, etc.
My website uses a table to store usernames, passwords and roles. These columns are populated at registration time. My goal is to redirect users at login time based on their role in Siteuser table. A user with one role may now access the folder of users of the other role. In order to get role management to work, how do I integrate the new tables created with my existing table ? In order to use this role management, do I have to now transfer all the columns in my existing table to this membership table? Or, is it possible to cross reference my existing table for username, password and role into these tables?
authenticated = Authentication(Login1.UserName, Login1.Password)
If authenticated Then
Dim a As Boolean = Roles.IsUserInRole(Login1.UserName, "user")
Dim b As Boolean = Roles.IsUserInRole(Login1.UserName, "processor")
Dim UserName As String = Login1.UserName
If Roles.IsUserInRole(Login1.UserName, "user") Then
Response.Redirect("~/users/Default.aspx")
ElseIf Roles.IsUserInRole(Login1.UserName, "processor") Then
Response.Redirect("~/users2/Default.aspx")
End If
FormsAuthentication.RedirectFromLoginPage
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Appname" value="MortgageLoanApply.com"/>
<add key="AppPath" value="/mortgageLoanapply"/>
<add key="AppName2" value="MortgageLoanApply.com"/>
</appSettings>
<connectionStrings>
<add name="sqlConnectionString" connectionString="Connect Timeout=8; Initial Catalog=MortgageApps; Data Source=DESKTOP-SBLF5UV\SQLEXPRESS;integrated security=true;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!-- Configure the Sql Role Provider -->
<roleManager enabled ="true" defaultProvider ="SqlRoleProvider" >
<providers>
<add name ="SqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="sqlConnectionString"
applicationName="MembershipAndRoleProviderSample"/> <--what should this be pointing to in my database?
</providers>
</roleManager>
<!-- Configure the Sql Membership Provider -->
<membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="SqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="sqlConnectionString"
applicationName="MembershipAndRoleProviderSample"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed" />
</providers>
</membership>
California Mortgage | California refinance
Member
247 Points
1310 Posts
Re: Role management not working
May 04, 2020 04:33 PM|sking|LINK
I have read some articles on role management, and I believe that I will have to create a column in my existing table with the userid created under the membership provdier. It will be of a long name with 32 digits I believe. This way I can cross reference the membership table. i will give this a try.
California Mortgage | California refinance