can't see role in production version

K

Keith G Hicks

asp.net 2.0 (ms sql 2005)

Worked in development but not on production site. I'm testing roles in a
couple of pages:

if My.User.IsInRole("adminstrators") then
'do stuff or not
endif

Like I said, this all works fine in development.

When I run it on the remote server I can log in and it finds the user and
the login process seems fine but it cannot see the role for some reason.

I put this in the Page_Load event of my default page:

Response.Write("name: " & My.User.Name)
Response.Write("; role: " & String.Join(",",
Roles.GetRolesForUser(My.User.Name)))


the Role comes up blank (in production version)

Can anyone tell me what might be wrong?

Thanks,

Keith
 
K

Keith G Hicks

I ought to mention that I'm using a slightly custom membership provider
using the standard asp.net 2.0 membership tables/views/procedures but
they're in my sql 2005 db via the aspnet_regsql.exe utility. It's only
custom in that it's not using the default mdf file in the App_Data folder
but rather as I said the same tables but in the main database for my app.
Not sure if that makes any difference or not.
 
K

Keith G Hicks

Never mind. I took my 2 Siberian Huskies for a nice long 10 mile hike in the
unexpected snow tonight. While I was out it occurred to me that I should set
the applicationName not only in the membership provider code in web.config
but also in the role provider code. So I just tried that and it solved the
problem. All's well so far. I'm sure other issues will pop up and look
forward to many more posts. :)

Keith
 

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
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top