Logon as different user

Discussion in 'ASP .Net' started by =?Utf-8?B?Z292ZXI=?=, May 22, 2007.

  1. Hello,
    I want to provide the ability to log on to a web application on our
    intranet using different credentials like they do in Sharepoint 2007. When a
    user hits the site, i want him automatically loggged in using his windows
    credentials, but be able to swicth to different windows credentials from
    within the web app. How do I go about doing this?

    My current configuration is:
    <authentication mode="Windows" />
    <identity impersonate="true"/>

    <membership defaultProvider="MyADMembershipProvider">
    <providers>
    <add connectionStringName="ADConnectionString"
    connectionUsername="ust\rwg" enableSearchMethods="true"
    connectionPassword="aruba7" name="MyADMembershipProvider"
    type="System.Web.Security.ActiveDirectoryMembershipProvider,
    System.Web, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </providers>
    </membership>
     
    =?Utf-8?B?Z292ZXI=?=, May 22, 2007
    #1
    1. Advertising

  2. "gover" <> wrote in message
    news:...
    > Hello,
    > I want to provide the ability to log on to a web application on our
    > intranet using different credentials like they do in Sharepoint 2007.
    > When a
    > user hits the site, i want him automatically loggged in using his windows
    > credentials, but be able to swicth to different windows credentials from
    > within the web app. How do I go about doing this?
    >
    > My current configuration is:
    > <authentication mode="Windows" />
    > <identity impersonate="true"/>
    >
    > <membership defaultProvider="MyADMembershipProvider">
    > <providers>
    > <add connectionStringName="ADConnectionString"
    > connectionUsername="ust\rwg" enableSearchMethods="true"
    > connectionPassword="aruba7" name="MyADMembershipProvider"
    > type="System.Web.Security.ActiveDirectoryMembershipProvider,
    > System.Web, Version=2.0.0.0,
    > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    > </providers>
    > </membership>
    >


    Sharepoint doesn't impersonate the user. If impersonation is enabled,
    ASP.NET executes under the authenticated user's user account

    In your case, I think, you can impersonate a specific user in a code, as per
    example:
    http://support.microsoft.com/kb/306158
     
    Alexey Smirnov, May 22, 2007
    #2
    1. Advertising

  3. "Alexey Smirnov" <> wrote in message
    news:%...
    >
    > "gover" <> wrote in message
    > news:...
    >> Hello,
    >> I want to provide the ability to log on to a web application on our
    >> intranet using different credentials like they do in Sharepoint 2007.
    >> When a
    >> user hits the site, i want him automatically loggged in using his windows
    >> credentials, but be able to swicth to different windows credentials from
    >> within the web app. How do I go about doing this?


    yet another thought about this. To force the logon prompt send to the
    browser Response.Status = "401 Unauthorized". A 401 HTTP response code tells
    the client that authentication information is required. You should also
    specify what kind of authentication should be used. A special HTTP header
    should be sent for that. For Windows Authentication it is "WWW-Authenticate
    NTLM", where NTLM is a Windows-specific method.

    Example:

    If IsNothing(Session("NTLM")) Then

    Session.Add("NTLM", "ok")
    Response.Status = "401 Unauthorized"
    Response.AddHeader("WWW-Authenticate", "NTLM")
    Response.End()

    Else

    Session.Remove("NTLM")
    Response.Redirect("/default.aspx")

    End If

    Put this code in the login.aspx and use this page to change the account.

    Hope it works :)
     
    Alexey Smirnov, May 22, 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. John Dalberg
    Replies:
    1
    Views:
    572
    John Dalberg
    Feb 10, 2005
  2. tamer kavlak
    Replies:
    0
    Views:
    408
    tamer kavlak
    Jan 13, 2005
  3. Kevin Holleran

    Impersonating a Different Logon

    Kevin Holleran, Apr 6, 2010, in forum: Python
    Replies:
    0
    Views:
    201
    Kevin Holleran
    Apr 6, 2010
  4. Mike Kingscott
    Replies:
    0
    Views:
    105
    Mike Kingscott
    Jul 24, 2003
  5. Kjell Kristiansson
    Replies:
    0
    Views:
    288
    Kjell Kristiansson
    Nov 30, 2005
Loading...

Share This Page