Context.user not retaining it's value

Discussion in 'ASP .Net' started by John Kraft, Aug 13, 2003.

  1. John Kraft

    John Kraft Guest

    I'm attempting to use the context.user object. In my login code, I add
    an identity to the context.user. I can use the debugger to watch it
    stuff the identity into the context.user object, but when I later try to
    check the context.user.identity.name it contains the empty string ("").

    Does anyone know why this would be the case?

    John
     
    John Kraft, Aug 13, 2003
    #1
    1. Advertising

  2. John,

    The context object is recreated every page load.

    Are you trying to use it later in the code, on a different page, or on
    postback to the same page?

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "John Kraft" <> wrote in message
    news:bhdnvh$ho7$...
    > I'm attempting to use the context.user object. In my login code, I add
    > an identity to the context.user. I can use the debugger to watch it
    > stuff the identity into the context.user object, but when I later try to
    > check the context.user.identity.name it contains the empty string ("").
    >
    > Does anyone know why this would be the case?
    >
    > John
    >
     
    S. Justin Gengo, Aug 13, 2003
    #2
    1. Advertising

  3. John Kraft

    John Kraft Guest

    John Saunders wrote:
    > "John Kraft" <> wrote in message
    > news:bhdrug$kjg$...
    >
    >>S. Justin Gengo wrote:
    >>
    >>
    >>>John,
    >>>
    >>>The context object is recreated every page load.
    >>>
    >>>Are you trying to use it later in the code, on a different page, or on
    >>>postback to the same page?
    >>>
    >>>Sincerely,
    >>>

    >>
    >>Well, that would certainly explain it.
    >>
    >>Here's the dealio...
    >>I am currently using(attempting to use) forms authentication on a site.
    >> We have only certain directories which need to have the user log in.
    >>What I wanted to do was put a little login box on each page and if the
    >>user chose to use the login box, it would carry his credentials with
    >>him. Than way, if he later went to one of the directories that required
    >>authentication, he would already be authenticated and let in

    >
    > automatically.
    >
    >>The problem is... I really don't fully understand what I am doing and
    >>was trying to mimic the code that I have (copied from some example on
    >>the net) in the global asax file in the authenticate_request method.

    >
    >
    > I strongly suggest you look into Forms Authentication (see "Forms
    > Authentication Provider" at
    > http://msdn.microsoft.com/library/d...conformsauthenticationacrossapplications.asp).
    >
    > When you do, I also strongly suggest that you first forget everything you
    > know about the technique you were trying to use. Then, once you understand
    > Forms Authentication, you can see how it relates to what you've got now.
    > I've seen too many attempts to twist Forms Authentication into something it
    > wasn't meant to do, rather than learn what it actually does.


    Ok... I appreciate you pointing me at that site. I've read it. It
    pretty much makes sense, and our forms auth is working as advertised.

    Now... to do what I wish to do... in theory... all I should have to do
    is authenticate the user myself in my little login box, and then add a
    cookie to the system.

    Isn't this correct?

    Well, it won't let me add a cookie to the system.
    Response.cookies.add() doesn't seem to work from my little control.

    Argh???

    John
     
    John Kraft, Aug 14, 2003
    #3
    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. Replies:
    20
    Views:
    9,864
    licebmi
    Sep 7, 2009
  2. Karthikeyan
    Replies:
    1
    Views:
    337
  3. Andy B.
    Replies:
    2
    Views:
    1,749
    Andy B.
    Apr 1, 2009
  4. Etrast

    Dynamic Template Column - retaining value on postback

    Etrast, Jun 17, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    330
    Tim_k
    Jun 30, 2004
  5. Etrast

    Dynamic Template Column - retaining value on postback

    Etrast, Jun 17, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    254
    Andy Z Smith
    Jun 17, 2004
Loading...

Share This Page