Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Forms auth. - User.IsInRole() - doesn't work

Reply
Thread Tools

Forms auth. - User.IsInRole() - doesn't work

 
 
Ufit
Guest
Posts: n/a
 
      11-29-2006
I put the code from msdn that assigns the roles to user using Security and FormsAuthentcation
classes and place in Global.asax AuthenticateRequest() - getting from decrypted cookie.
Code is from f.ex http://support.microsoft.com/kb/308157
After creating a new identity (Global.asax)
HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, myRoles);
on my other page the following code gives me false
User.IsInRole(".....")
The same line returns true in Global.asax so it should work on other page
but it doesn't. Why?
All is coded fine but I suspect something might be set wrong in Web.config.
Anyone could help and suggest how to solve that issue?
I use VS 2005 WAP model.
Big thanks.

Uf




 
Reply With Quote
 
 
 
 
Ufit
Guest
Posts: n/a
 
      11-29-2006
Never mind - problem solved. Just disable the roles in ASP.NET configuration
and all works fine.)

Uf
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
embedded windows forms into web forms for control =?Utf-8?B?ZGF2aWQ=?= ASP .Net 2 04-10-2005 01:07 PM
Creating ASP.NET forms, that act like HTML forms jlopes151 ASP .Net 2 03-14-2005 01:01 AM
Forms Authentication question: How to have some pages open and some requiring forms authentication Eric ASP .Net 2 02-13-2004 02:14 PM
Web Forms VS Windows Forms Brendan Miller ASP .Net 2 08-11-2003 09:05 PM



Advertisments