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
Keith G Hicks - 28 Mar 2008 01:16 GMT
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.
> asp.net 2.0 (ms sql 2005)
>
[quoted text clipped - 23 lines]
>
> Keith
Keith G Hicks - 28 Mar 2008 05:14 GMT
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
> 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
[quoted text clipped - 30 lines]
> >
> > Keith