473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with GetAllRoles


i used the example in the MSDN to getroles and assign users to it on
my local development plat form and it worked flawlessly, When I move
the same code production, the rolesListbox does not get poplated. What
differences in the two environment can cuase this? What can I do to
overwrite this GetAllroles routine so that I can be assured I can get
the roles in the current application?

Here is the code, any insight will be much appreciated.

Dim rolesArray() As String
Dim users As MembershipUserCollection
Dim usersInRole() As String

Public Sub Page_Load()

Msg.Text = ""

If Not IsPostBack Then
' Bind roles to ListBox.
rolesArray = Roles.GetAllRoles()
RolesListBox.DataSource = rolesArray
RolesListBox.DataBind()

' Bind users to ListBox.

users = Membership.GetAllUsers()
UsersListBox.DataSource = users
UsersListBox.DataBind()
End If

If Not RolesListBox.SelectedItem Is Nothing Then
' Show users in role. Bind user list to GridView.

usersInRole =
Roles.GetUsersInRole(RolesListBox.SelectedItem.Val ue)
UsersInRoleGrid.DataSource = usersInRole
UsersInRoleGrid.DataBind()
End If

End Sub

May 20 '07 #1
6 4670
On May 20, 1:20 pm, Fendi Baba <effe...@epitome.com.sgwrote:
i used the example in the MSDN to getroles and assign users to it on
my local development plat form and it worked flawlessly, When I move
the same code production, the rolesListbox does not get poplated. What
differences in the two environment can cuase this? What can I do to
overwrite this GetAllroles routine so that I can be assured I can get
the roles in the current application?

Here is the code, any insight will be much appreciated.

Dim rolesArray() As String
Dim users As MembershipUserCollection
Dim usersInRole() As String

Public Sub Page_Load()

Msg.Text = ""

If Not IsPostBack Then
' Bind roles to ListBox.
rolesArray = Roles.GetAllRoles()
RolesListBox.DataSource = rolesArray
RolesListBox.DataBind()

' Bind users to ListBox.

users = Membership.GetAllUsers()
UsersListBox.DataSource = users
UsersListBox.DataBind()
End If

If Not RolesListBox.SelectedItem Is Nothing Then
' Show users in role. Bind user list to GridView.

usersInRole =
Roles.GetUsersInRole(RolesListBox.SelectedItem.Val ue)
UsersInRoleGrid.DataSource = usersInRole
UsersInRoleGrid.DataBind()
End If

End Sub
Check your web.config and a roles provider
http://msdn2.microsoft.com/en-us/lib...ity.roles.aspx

May 20 '07 #2
On May 20, 10:18 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 20, 1:20 pm, Fendi Baba <effe...@epitome.com.sgwrote:


i used the example in the MSDN to getroles and assign users to it on
my local development plat form and it worked flawlessly, When I move
the same code production, the rolesListbox does not get poplated. What
differences in the two environment can cuase this? What can I do to
overwrite this GetAllroles routine so that I can be assured I can get
the roles in the current application?
Here is the code, any insight will be much appreciated.
Dim rolesArray() As String
Dim users As MembershipUserCollection
Dim usersInRole() As String
Public Sub Page_Load()
Msg.Text = ""
If Not IsPostBack Then
' Bind roles to ListBox.
rolesArray = Roles.GetAllRoles()
RolesListBox.DataSource = rolesArray
RolesListBox.DataBind()
' Bind users to ListBox.
users = Membership.GetAllUsers()
UsersListBox.DataSource = users
UsersListBox.DataBind()
End If
If Not RolesListBox.SelectedItem Is Nothing Then
' Show users in role. Bind user list to GridView.
usersInRole =
Roles.GetUsersInRole(RolesListBox.SelectedItem.Val ue)
UsersInRoleGrid.DataSource = usersInRole
UsersInRoleGrid.DataBind()
End If
End Sub

Check your web.config and a roles providerhttp://msdn2.microsoft.com/en-us/library/system.web.security.roles.aspx- Hide quoted text -

- Show quoted text -
Alexey

Both my development and production web.config is the same. Both had
the line

<roleManager enabled="true" />

I did a quick test and added the custom role provider section in the
web.config in my development server and the rolelistbox which worked
fails to get any roles.

Any ideas what else could be the cause

May 20 '07 #3
On May 20, 4:35 pm, Fendi Baba <effe...@epitome.com.sgwrote:
On May 20, 10:18 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:


On May 20, 1:20 pm, Fendi Baba <effe...@epitome.com.sgwrote:
i used the example in the MSDN to getroles and assign users to it on
my local development plat form and it worked flawlessly, When I move
the same code production, the rolesListbox does not get poplated. What
differences in the two environment can cuase this? What can I do to
overwrite this GetAllroles routine so that I can be assured I can get
the roles in the current application?
Here is the code, any insight will be much appreciated.
Dim rolesArray() As String
Dim users As MembershipUserCollection
Dim usersInRole() As String
Public Sub Page_Load()
Msg.Text = ""
If Not IsPostBack Then
' Bind roles to ListBox.
rolesArray = Roles.GetAllRoles()
RolesListBox.DataSource = rolesArray
RolesListBox.DataBind()
' Bind users to ListBox.
users = Membership.GetAllUsers()
UsersListBox.DataSource = users
UsersListBox.DataBind()
End If
If Not RolesListBox.SelectedItem Is Nothing Then
' Show users in role. Bind user list to GridView.
usersInRole =
Roles.GetUsersInRole(RolesListBox.SelectedItem.Val ue)
UsersInRoleGrid.DataSource = usersInRole
UsersInRoleGrid.DataBind()
End If
End Sub
Check your web.config and a roles providerhttp://msdn2.microsoft.com/en-us/library/system.web.security.roles.aspx-Hide quoted text -
- Show quoted text -

Alexey

Both my development and production web.config is the same. Both had
the line

<roleManager enabled="true" />

I did a quick test and added the custom role provider section in the
web.config in my development server and the rolelistbox which worked
fails to get any roles.

Any ideas what else could be the cause- Hide quoted text -

- Show quoted text -
Have you populated the table aspnet_Roles on the remote server?

Have you specified an applicationName for all of your providers
property?

For example

<providers>
<add connectionStringName="..."
name="SqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
applicationName="/"
/>
</providers>

Hope it helps

May 20 '07 #4
On May 21, 12:17 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 20, 4:35 pm, Fendi Baba <effe...@epitome.com.sgwrote:


On May 20, 10:18 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 20, 1:20 pm, Fendi Baba <effe...@epitome.com.sgwrote:
i used the example in the MSDN to getroles and assign users to it on
my local development plat form and it worked flawlessly, When I move
the same code production, the rolesListbox does not get poplated. What
differences in the two environment can cuase this? What can I do to
overwrite this GetAllroles routine so that I can be assured I can get
the roles in the current application?
Here is the code, any insight will be much appreciated.
Dim rolesArray() As String
Dim users As MembershipUserCollection
Dim usersInRole() As String
Public Sub Page_Load()
Msg.Text = ""
If Not IsPostBack Then
' Bind roles to ListBox.
rolesArray = Roles.GetAllRoles()
RolesListBox.DataSource = rolesArray
RolesListBox.DataBind()
' Bind users to ListBox.
users = Membership.GetAllUsers()
UsersListBox.DataSource = users
UsersListBox.DataBind()
End If
If Not RolesListBox.SelectedItem Is Nothing Then
' Show users in role. Bind user list to GridView.
usersInRole =
Roles.GetUsersInRole(RolesListBox.SelectedItem.Val ue)
UsersInRoleGrid.DataSource = usersInRole
UsersInRoleGrid.DataBind()
End If
End Sub
Check your web.config and a roles providerhttp://msdn2.microsoft.com/en-us/library/system.web.security.roles.as...quoted text -
- Show quoted text -
Alexey
Both my development and production web.config is the same. Both had
the line
<roleManager enabled="true" />
I did a quick test and added the custom role provider section in the
web.config in my development server and the rolelistbox which worked
fails to get any roles.
Any ideas what else could be the cause- Hide quoted text -
- Show quoted text -

Have you populated the table aspnet_Roles on the remote server?

Have you specified an applicationName for all of your providers
property?

For example

<providers>
<add connectionStringName="..."
name="SqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
applicationName="/"
/>
</providers>

Hope it helps- Hide quoted text -

- Show quoted text -
Yes, the roles are all populated int he remote server and it's already
in production. Currently users have been assign to the roles though
the administrative interface provided through VIsual Studio.

May 21 '07 #5
On May 21, 3:54 pm, Fendi Baba <effe...@epitome.com.sgwrote:
Have you specified an applicationName for all of your providers
property?
applicationName?

May 21 '07 #6
On May 21, 4:12 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 21, 3:54 pm, Fendi Baba <effe...@epitome.com.sgwrote:
Have you specified anapplicationNamefor all of your providers
property?

applicationName?
Any news? Just came accross this great post about the same issue
http://weblogs.asp.net/scottgu/archi...22/443634.aspx

May 22 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Bob | last post by:
Hi All: I have a page where the managers can maintain their own users - GridView is populated with the list of users. When the manager adds a new user (button click event calls...
1
by: Mike | last post by:
Hi I am using predefined membership and roles managemant approach characteristic for framework 2.0 Basic idea is that we select some value from DropDownList which represents a role and we get...
1
by: Mike | last post by:
Hi I am using predefined membership and roles managemant approach characteristic for framework 2.0 Basic idea is that we select some value from DropDownList which represents a role and we get...
0
by: mazdotnet | last post by:
Hi, I just started using the new asp.net sqlMembershipProvider (users and roles) which works great. However, I'm testing my application on Windows XP and I'm getting different list of roles...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.