HttpContext.Current.User.IsInRole

G

Guest

Hi,
In my asp.net app I am using this code:

FormsAuthenticationTicket ticket =
new FormsAuthenticationTicket(
1,
lcred.UserName,
DateTime.Now,
DateTime.Now.AddMinutes(ldExpiration),
false,
lsRoles
);

lsRoles is a string with all roles (separated with "|").

When I later use the HttpContext.Current.User.IsInRole method it works fine
on my developer machine but not on my production machine... what can be wrong.

Thanks
 
K

Karl Seguin

From what you've shown us, you aren't doing enough to get it work (not sure
why it's working in dev).

Take a look at:
http://www.codeproject.com/aspnet/AspNetCustomAuth.asp

But you should be getting the roles (from the cookie if they are there, or
from wherever else if they aren't) and creating a new IPrincipal user which
you assign to the Context.User.

Karl
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top