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

Discussion in 'ASP .Net' started by Ufit, Nov 29, 2006.

  1. Ufit

    Ufit Guest

    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
    Ufit, Nov 29, 2006
    #1
    1. Advertising

  2. Ufit

    Ufit Guest

    Never mind - problem solved. Just disable the roles in ASP.NET configuration
    and all works fine.)

    Uf
    Ufit, Nov 29, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2hyaXMgTW9oYW4=?=

    Configuring Windows Auth & Forms Auth in Asp.Net

    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=, Apr 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    687
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Apr 28, 2004
  2. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Windows Auth, but Forms Auth for one page?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Jan 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    546
    Elton Wang
    Jan 8, 2005
  3. Peter Bradley
    Replies:
    2
    Views:
    1,204
    Peter Bradley
    Jan 19, 2007
  4. petersonrj
    Replies:
    0
    Views:
    124
    petersonrj
    Sep 17, 2004
  5. Dominick Baier
    Replies:
    2
    Views:
    191
    Patrick.O.Ige
    Oct 21, 2004
Loading...

Share This Page