client login name

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

    client login name

    Hello,

    I have to identify the user of an asp.net site by his windows login
    name (like environment.cur rentuser in Access). Till a few days I'm
    trying several scripts I've found. For example one like this:
    strLogonName =
    System.Security .Principal.Wind owsIdentity.Get Current().Name

    The best result was to display the asp-account on the Server. But I
    need the username on the client.

    We are working in a windows2k environment with iis 6 and asp.net 1.1.

    Thanks for help!

  • Phillip Ian

    #2
    Re: client login name

    Give HttpContext.Use r.Identity.Name a try...pretty sure that's what
    you're looking for.

    Comment

    • Hans Kesting

      #3
      Re: client login name

      catweezle2010 wrote:[color=blue]
      > Hello,
      >
      > I have to identify the user of an asp.net site by his windows login
      > name (like environment.cur rentuser in Access). Till a few days I'm
      > trying several scripts I've found. For example one like this:
      > strLogonName =
      > System.Security .Principal.Wind owsIdentity.Get Current().Name
      >
      > The best result was to display the asp-account on the Server. But I
      > need the username on the client.
      >
      > We are working in a windows2k environment with iis 6 and asp.net 1.1.
      >
      > Thanks for help![/color]

      If your site allows anonymous access (in IIS !), then you will never get
      a login-name. So clear that checkbox.
      Then you can use
      this.Page.User as WindowsPrincipa l
      to get at the login data.

      Hans Kesting


      Comment

      • catweezle2010

        #4
        Re: client login name

        Thanks - now have an error which I had not before:
        Compiler Error Message: BC30469: Reference to a non-shared member
        requires an object reference.
        The code: strLogonName = HttpContext.Use r.Identity.Name

        Comment

        • Elton W

          #5
          RE: client login name

          In your scenario, you can

          1) Set Windows authentication:
          in Web.Config file
          <authenticati on mode="Windows"/>

          2) Deny anonymous access
          in Web.Config file
          <authorizatio n>
          <deny users="?" /> <!-- Deny anonymous users -->
          <allow users="*"/> <!-- Allow all other users -->
          </authorization>

          3) Then use
          User.Identity.N ame
          to get Domain_Name\Use r_Win_Login_ID

          HTH

          Elton Wang
          elton_Wang@hotm ail.com




          "catweezle2 010" wrote:
          [color=blue]
          > Hello,
          >
          > I have to identify the user of an asp.net site by his windows login
          > name (like environment.cur rentuser in Access). Till a few days I'm
          > trying several scripts I've found. For example one like this:
          > strLogonName =
          > System.Security .Principal.Wind owsIdentity.Get Current().Name
          >
          > The best result was to display the asp-account on the Server. But I
          > need the username on the client.
          >
          > We are working in a windows2k environment with iis 6 and asp.net 1.1.
          >
          > Thanks for help!
          >
          >[/color]

          Comment

          • catweezle2010

            #6
            Re: client login name

            Thanks to all, a long search is ending here.

            @Elton W: I allready used user.identity.n ame but failed.

            My settings in IIS an web.config were right, but it seems they do not
            work without the <autorization > part in web.config.

            So thanks a lot. Maybe you can help me in my next post (loosing session
            value).

            Comment

            • Hans Kesting

              #7
              Re: client login name

              catweezle2010 wrote:[color=blue]
              > Thanks - now have an error which I had not before:
              > Compiler Error Message: BC30469: Reference to a non-shared member
              > requires an object reference.
              > The code: strLogonName = HttpContext.Use r.Identity.Name[/color]

              add a "Current" inbetween:
              HttpContext.Cur rent.User.Ident ity.Name

              Hans Kesting


              Comment

              Working...