HttpContext.Current.User.IsInRole

Discussion in 'ASP .Net' started by =?Utf-8?B?SnVsaWE=?=, Dec 12, 2005.

  1. 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
     
    =?Utf-8?B?SnVsaWE=?=, Dec 12, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?SnVsaWE=?=

    Karl Seguin Guest

    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
    --
    MY ASP.Net tutorials
    http://www.openmymind.net/
    http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



    "Julia" <> wrote in message
    news:...
    > 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
     
    Karl Seguin, Dec 12, 2005
    #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. Mike Newton
    Replies:
    0
    Views:
    2,921
    Mike Newton
    Jul 23, 2004
  2. Peter Bons
    Replies:
    1
    Views:
    512
    Patrick.O.Ige
    Mar 31, 2006
  3. Randy
    Replies:
    1
    Views:
    689
    Joe Kaplan \(MVP - ADSI\)
    Sep 2, 2004
  4. Julia

    HttpContext.Current.User.IsInRole

    Julia, Apr 6, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    167
    Joe Kaplan \(MVP - ADSI\)
    Apr 6, 2005
  5. Tony

    Dim context As HttpContext = HttpContext.Current

    Tony, Mar 2, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    318
    Teemu Keiski
    Mar 3, 2004
Loading...

Share This Page