asp.net 2.0 roles not working when deploying to web server

H

Homer

Hi,

I'm developing my first ever web application and I'm running into a
lot of problems. My problem I'm encountering now is how to make roles
work when I deploy my web app to my company's server. It's an
Intranet application. I used forms authentication and I enabled the
role manager in the web.config file. I created a folder in the
application root directory and put all the web pages that require
authentication in there. Then I created a web.config file for that
folder like the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authorization>
<deny users="*" />
</authorization>
</system.web>
<location path="HRSearch.aspx">
<system.web>
<authorization>
<allow roles="HumanResourceMember"/>
</authorization>
</system.web>
</location>
<location path="YourInformation.aspx">
<system.web>
<authorization>
<allow roles="User, HumanResourceMember"/>
</authorization>
</system.web>
</location>
</configuration>

the next thing I did was adding roles into the site.sitemap file like
the following:

<siteMapNode url="Default.aspx"
title="Home"
description="Home page">
<siteMapNode title="Personnel Information" roles="*" >
<siteMapNode url="PersonnelInformation/HRSearch.aspx"
title="Personnel Search"
description="This option is only available to HR
staff"
roles="HumanResourceMember" />
<siteMapNode url="PersonnelInformation/YourInformation.aspx"
title="Your Information"
description="Your personal information"
roles="User,HumanResourceMember"/>
</siteMapNode

The roles implementation works on my development machine but when I
deployed the application to my company's IIS server it does not work.
When I login in as a member of the user role, I expect to see the
"Your Information" page. When I login as a member of the
HumanResourceMember, I expect to see the "Personnel Search" page. It
works wonderfully on my XP development machine but neither of the
aforementioned pages show up when I login to it remotely. I don't
even know how to google this problem. Please help me.

Thank you,
Jon
 
H

Homer

Start by reading another news article posted earlier today: "Membership
database problems."

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URLhttp://clintongallagher.metromilwaukee.com/













- Show quoted text -

Hi Clinton,

The link you provided is not valid. I did a search on membership
database problems but did not find anything applicable to my problem.
I use the aspnet_sql tool to integrate the membership database with my
existing database and I override the pointer in the web.config file as
follows:

<membership defaultProvider="CustomizedProvider">
<providers>
<add name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="csEmployeeSelfService"
applicationName="EOIntranet"/>
</providers>
</membership>

<roleManager enabled="true"
defaultProvider="CustomizedRoleProvider">
<providers>
<add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="csEmployeeSelfService"/>
</providers>
</roleManager>

Please advise. Thanks.
 
C

Cowboy \(Gregory A. Beamer\)

Did you actually put the roles in the live database or did you only use the
web.config tool on your local database? If you did not actually migrate the
roles, there is your problem.
 
H

Homer

One more idea. You did actually put an application name for the application
(in the providers portion of the web.config file)?http://weblogs.asp.net:80/scottgu/archive/2006/04/22/Always-set-the-_...


message





- Show quoted text -

Hi Gregory,

Yes, I did put the roles in the production database. I used the
aspnet_sql tool to create the whole authentication schema on my
production database at the very beginning and added this block of code
in the application's web.config file as follows:

<membership defaultProvider="CustomizedProvider">
<providers>
<add name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="csEmployeeSelfService"
applicationName="EOIntranet"/>
</providers>
</membership>


<roleManager enabled="true"
defaultProvider="CustomizedRoleProvider">
<providers>
<add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="csEmployeeSelfService"
applicationName="EOIntranet"/>
</providers>
</roleManager>

On your second suggestion, I did not give the roleManager provider an
application name initially. I added it in just now and it's still not
working.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,037
Messages
2,570,371
Members
47,013
Latest member
JewellChes

Latest Threads

Top