|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HttpContext.Current.User.IsInRoleIn 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 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 -- Show quoteHide quoteMY ASP.Net tutorials http://www.openmymind.net/ http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX! "Julia" <Ju***@discussions.microsoft.com> wrote in message news:AE811E42-4A85-49C3-B1B6-E6EF227A3731@microsoft.com... > 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
Other interesting topics
Raising events
ASP.NET 2.0 Themes are not WYSIWYG Javascript two fields merged to one hidden field Print Page CheckBox unchecked status detection in DataGrid Template Column Rewriting a URL that does not point to a file Role based security Connection String how to... Formatting Binding controls with datasourse |
|||||||||||||||||||||||