Can we set User.Identity by program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ad

    #1

    Can we set User.Identity by program

    The User.Identity of WebPages is set with login controls in asp.net 2.0.
    Can we set the User.Identity with program not by Login Controls?

    I have tried the code:
    this.User.Ident ity="Jhon", but it fail when compile.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Can we set User.Identity by program

    ad,

    Yes, you can set the user identity yourself. However, you can't just
    set the identity like you want.

    What you need to do is create a custom membership and possibly a role
    provider for ASP.NET.

    Take a look at the document on MSDN titled "Membership Providers",
    located at (watch for line wrap):

    http://msdn.microsoft.com/library/de...vMod_Intro.asp

    It should help you out.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "ad" <flying@wfes.tc c.edu.tw> wrote in message
    news:O9VxUxbIGH A.3408@TK2MSFTN GP12.phx.gbl...[color=blue]
    > The User.Identity of WebPages is set with login controls in asp.net 2.0.
    > Can we set the User.Identity with program not by Login Controls?
    >
    > I have tried the code:
    > this.User.Ident ity="Jhon", but it fail when compile.
    >
    >[/color]


    Comment

    • ad

      #3
      Re: Can we set User.Identity by program

      Thanks,
      But it is so tedious. Have there any simple ways?

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> ¼¶¼g©ó¶l¥ó·s»D: %235wnGecIGHA.3 896@TK2MSFTNGP1 5.phx.gbl...[color=blue]
      > ad,
      >
      > Yes, you can set the user identity yourself. However, you can't just
      > set the identity like you want.
      >
      > What you need to do is create a custom membership and possibly a role
      > provider for ASP.NET.
      >
      > Take a look at the document on MSDN titled "Membership Providers",
      > located at (watch for line wrap):
      >
      > http://msdn.microsoft.com/library/de...vMod_Intro.asp
      >
      > It should help you out.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "ad" <flying@wfes.tc c.edu.tw> wrote in message
      > news:O9VxUxbIGH A.3408@TK2MSFTN GP12.phx.gbl...[color=green]
      >> The User.Identity of WebPages is set with login controls in asp.net 2.0.
      >> Can we set the User.Identity with program not by Login Controls?
      >>
      >> I have tried the code:
      >> this.User.Ident ity="Jhon", but it fail when compile.
      >>
      >>[/color]
      >
      >[/color]


      Comment

      Working...