Getting a AD user name ...

Discussion in 'ASP .Net Security' started by David Lozzi, Dec 3, 2007.

  1. David Lozzi

    David Lozzi Guest

    Howdy,

    I have an ASP.Net 2.0 web application for which all i need to do is grab the
    user's login name. Currently, IIS is configured for anonymous access, which
    i need to keep. I tried request.servervariables("LOGON_USER") and
    REMOTE_USER, both return nothing. If I disable anonymouse security in IIS it
    works and returns my login name.

    I have also enabled forms authentication on my application, see below, and i
    simply get page cannot be found, which is getting annoying. I don't need to
    do anything with AD except get the user name, so using the full membership
    class for AD is a little over kill. I am storing all of the user's
    permissions for the app in the application using basic session strings. But
    i'll do what it takes. Any ideas??

    <connectionStrings>
    <add name="ADConnectionString"
    connectionString="LDAP://delphi.local/CN=Users,DC=delphi,DC=local" />
    </connectionStrings>

    <authentication mode="Forms">
    <forms name=".ADAuthCookie" timeout="30" >
    </forms>
    </authentication>
    <authorization>
    <deny users="?"/>
    <allow users="*"/>
    </authorization>
    <membership defaultProvider="MyADMembershipProvider">
    <providers>
    <add name="MyADMembershipProvider"
    type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    connectionStringName="ADConnectionString" connectionUsername="delphi\dlozzi"
    connectionPassword="12345"/>
    </providers>
    </membership>

    Thanks!!

    David Lozzi
    Blog: http://www.lozzi.net
     
    David Lozzi, Dec 3, 2007
    #1
    1. Advertising

  2. David Lozzi

    Joe Kaplan Guest

    Why not just enable Windows authentication in IIS? It is by far the easiest
    way to go. What is the attraction with doing forms authentication?

    Joe K.

    --
    Joe Kaplan-MS MVP Directory Services Programming
    Co-author of "The .NET Developer's Guide to Directory Services Programming"
    http://www.directoryprogramming.net
    --
    "David Lozzi" <> wrote in message
    news:D...
    > Howdy,
    >
    > I have an ASP.Net 2.0 web application for which all i need to do is grab
    > the user's login name. Currently, IIS is configured for anonymous access,
    > which i need to keep. I tried request.servervariables("LOGON_USER") and
    > REMOTE_USER, both return nothing. If I disable anonymouse security in IIS
    > it works and returns my login name.
    >
    > I have also enabled forms authentication on my application, see below, and
    > i simply get page cannot be found, which is getting annoying. I don't need
    > to do anything with AD except get the user name, so using the full
    > membership class for AD is a little over kill. I am storing all of the
    > user's permissions for the app in the application using basic session
    > strings. But i'll do what it takes. Any ideas??
    >
    > <connectionStrings>
    > <add name="ADConnectionString"
    > connectionString="LDAP://delphi.local/CN=Users,DC=delphi,DC=local" />
    > </connectionStrings>
    >
    > <authentication mode="Forms">
    > <forms name=".ADAuthCookie" timeout="30" >
    > </forms>
    > </authentication>
    > <authorization>
    > <deny users="?"/>
    > <allow users="*"/>
    > </authorization>
    > <membership defaultProvider="MyADMembershipProvider">
    > <providers>
    > <add name="MyADMembershipProvider"
    > type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,
    > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    > connectionStringName="ADConnectionString"
    > connectionUsername="delphi\dlozzi" connectionPassword="12345"/>
    > </providers>
    > </membership>
    >
    > Thanks!!
    >
    > David Lozzi
    > Blog: http://www.lozzi.net
     
    Joe Kaplan, Dec 4, 2007
    #2
    1. Advertising

  3. David Lozzi

    David Lozzi Guest

    I did. I don't know why I wanted forms auth... been a long freaken month

    Thanks


    "Joe Kaplan" <> wrote in message
    news:...
    > Why not just enable Windows authentication in IIS? It is by far the
    > easiest way to go. What is the attraction with doing forms
    > authentication?
    >
    > Joe K.
    >
    > --
    > Joe Kaplan-MS MVP Directory Services Programming
    > Co-author of "The .NET Developer's Guide to Directory Services
    > Programming"
    > http://www.directoryprogramming.net
    > --
    > "David Lozzi" <> wrote in message
    > news:D...
    >> Howdy,
    >>
    >> I have an ASP.Net 2.0 web application for which all i need to do is grab
    >> the user's login name. Currently, IIS is configured for anonymous access,
    >> which i need to keep. I tried request.servervariables("LOGON_USER") and
    >> REMOTE_USER, both return nothing. If I disable anonymouse security in IIS
    >> it works and returns my login name.
    >>
    >> I have also enabled forms authentication on my application, see below,
    >> and i simply get page cannot be found, which is getting annoying. I don't
    >> need to do anything with AD except get the user name, so using the full
    >> membership class for AD is a little over kill. I am storing all of the
    >> user's permissions for the app in the application using basic session
    >> strings. But i'll do what it takes. Any ideas??
    >>
    >> <connectionStrings>
    >> <add name="ADConnectionString"
    >> connectionString="LDAP://delphi.local/CN=Users,DC=delphi,DC=local" />
    >> </connectionStrings>
    >>
    >> <authentication mode="Forms">
    >> <forms name=".ADAuthCookie" timeout="30" >
    >> </forms>
    >> </authentication>
    >> <authorization>
    >> <deny users="?"/>
    >> <allow users="*"/>
    >> </authorization>
    >> <membership defaultProvider="MyADMembershipProvider">
    >> <providers>
    >> <add name="MyADMembershipProvider"
    >> type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,
    >> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    >> connectionStringName="ADConnectionString"
    >> connectionUsername="delphi\dlozzi" connectionPassword="12345"/>
    >> </providers>
    >> </membership>
    >>
    >> Thanks!!
    >>
    >> David Lozzi
    >> Blog: http://www.lozzi.net

    >
    >
     
    David Lozzi, Dec 11, 2007
    #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. nalbayo
    Replies:
    2
    Views:
    5,511
    Bruce Barker
    Nov 11, 2005
  2. =?iso-8859-1?B?bW9vcJk=?=
    Replies:
    7
    Views:
    832
    Roedy Green
    Jan 2, 2006
  3. ding feng
    Replies:
    2
    Views:
    2,825
    ding feng
    Jun 25, 2003
  4. Patrick

    Getting windows user-name without domain name

    Patrick, Dec 7, 2007, in forum: ASP .Net Security
    Replies:
    2
    Views:
    544
    Nikolay Podkolzin
    Dec 14, 2007
  5. Antonio O''Neal

    user.identity.name returns old AD user name

    Antonio O''Neal, Oct 31, 2008, in forum: ASP .Net Security
    Replies:
    5
    Views:
    2,078
    Antonio O''Neal
    Nov 3, 2008
Loading...

Share This Page