Passing windows credentials from server to server.

From: Wade Wegner (wwegner23_at_hotmail.com)
Date: 12/27/03

  • Next message: Thanh: "Re: Help, please"
    Date: Sat, 27 Dec 2003 11:24:32 -0700
    
    

    Hello,

    I have been desperately trying to programmatically authenticate a windows
    user, create their credentials, and then redirect them to a different server
    while passing the credentials at the same time so that they don't have to
    login again.

    Specifically, I have two webservers in the same domain. When I have a user
    go to Webserver A (which uses basic authentication) I programmatically
    create either a user credential or impersonate a user context (for now it's
    hardcoded, but in the future it would be entered in forms). Then, I want to
    let that user access a page on Webserver B (which uses basic
    authentication), but I don't want them to have to login again -- rather, I
    want to use the user context that I programmatically created on Webserver A.

    For instance, here is an example of the code I use to create the user
    credentials:

        Dim strURI = "http://www.whatever.com"
        Dim myCred As New NetworkCredential("userid", "password", "domain")
        Dim myURI As New Uri(strURI)
        Dim myCache As New CredentialCache
        myCache.Add(myURI, "Basic", myCred)

    >From this, I have attempted to use WebRequests and WebResponses to somehow
    allow me to direct the browser to a different page, and use the credential I
    have generated. The most I can do, however, is create the request and
    receive the response:

        Dim myWebRequest As System.Net.WebRequest =
    System.Net.WebRequest.Create(strURI)
        myWebRequest.Credentials = myCache
        Dim myWebResponse As WebResponse = myWebRequest.GetResponse()

    If only I could use the response.redirect method, and somehow pass the
    credentials with the redirection (like you can with the webrequest), it
    could work!

    I have also attempted to use the LogonUser API (from the advapi32.dll), and
    impersonate a user based on the proper logon information -- this works, and
    I'm able to successfully impersonate the user, but again, I don't know how
    to pass along the user context to a different page.

    I know that many people will say "just use form based authentication," but
    this will not work for me, as I want this to work with tools like Outlook
    Web Access, which requires windows authentication.

    Any help would be greatly appreciated. Thank you!!

    Wade


  • Next message: Thanh: "Re: Help, please"

    Relevant Pages

    • Re: Default credentials
      ... > comes up on my client site requires NTLM or Basic authentication? ... > a web browser - I assume it must be something they have set up ... If your receive a Dialog asking for your creds with NTLM auth ... credentials of the current security context. ...
      (microsoft.public.dotnet.framework.aspnet.webservices)
    • Re: Default credentials
      ... > comes up on my client site requires NTLM or Basic authentication? ... > a web browser - I assume it must be something they have set up ... If your receive a Dialog asking for your creds with NTLM auth ... credentials of the current security context. ...
      (microsoft.public.dotnet.framework.webservices)
    • Re: Default credentials
      ... > comes up on my client site requires NTLM or Basic authentication? ... > a web browser - I assume it must be something they have set up ... If your receive a Dialog asking for your creds with NTLM auth ... credentials of the current security context. ...
      (microsoft.public.dotnet.security)
    • Re: IIS6 - Integrated Authentication Probs
      ... When you use Basic authentication, ... outlined in Chapter 5 of the IIS 6 Resource Kit: ... > b) - Despite the fact these credentials are being parsed, ... > Hence - this is a general problem with the way the web server is using my ...
      (microsoft.public.inetserver.iis.security)
    • Re: Cached Logon
      ... > current credentials and only after failing would prompt for credentials. ... Keep in mind that whether the IE browser will supply the Windows ... the scenes" windows authentication information? ... > On the server I was logged in as domain1\administrator. ...
      (microsoft.public.sqlserver.connect)