Setting HttpWebRequest Credentials to be current user

Discussion in 'ASP .Net' started by Jamie, Feb 26, 2004.

  1. Jamie

    Jamie Guest

    I'm trying to create a HttpWebRequest object that uses the current logged in
    users credentials. The site is using Windows Authentication, Anonymous
    access is turned off.

    Will the HttpWebRequest object use the current users credentials if i use
    <identity impersonate="true" /> ? or do i have to set the Credentials
    property of the web request? If i do, how do i set it to be the current
    windows user logged into the application? I don't want to create a
    NetworkCredential object where i would have to pass in the login and
    password of the user.

    Thanks,
     
    Jamie, Feb 26, 2004
    #1
    1. Advertising

  2. Jamie

    richlm Guest

    e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;

    Look up System.Net on MSDN library for more info.

    Richard.

    "Jamie" <> wrote in message
    news:ONzlvoJ$...
    >
    > I'm trying to create a HttpWebRequest object that uses the current logged

    in
    > users credentials. The site is using Windows Authentication, Anonymous
    > access is turned off.
    >
    > Will the HttpWebRequest object use the current users credentials if i use
    > <identity impersonate="true" /> ? or do i have to set the Credentials
    > property of the web request? If i do, how do i set it to be the current
    > windows user logged into the application? I don't want to create a
    > NetworkCredential object where i would have to pass in the login and
    > password of the user.
    >
    > Thanks,
    >
    >
     
    richlm, Feb 26, 2004
    #2
    1. Advertising

  3. Jamie

    Jamie Guest

    Thanks. I tried that and thought it was working.. but it only seems to work
    when i'm on the same system as the webserver. When i go to another system
    and browse to the web page i get a (401) unauthorized error message.

    It's currently setup with

    <identity impersonate="true" /> in web.config

    IIS - Windows Authentication

    myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials



    "richlm" <> wrote in message
    news:%23JKkLzJ$...
    > e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;
    >
    > Look up System.Net on MSDN library for more info.
    >
    > Richard.
    >
    > "Jamie" <> wrote in message
    > news:ONzlvoJ$...
    > >
    > > I'm trying to create a HttpWebRequest object that uses the current

    logged
    > in
    > > users credentials. The site is using Windows Authentication, Anonymous
    > > access is turned off.
    > >
    > > Will the HttpWebRequest object use the current users credentials if i

    use
    > > <identity impersonate="true" /> ? or do i have to set the Credentials
    > > property of the web request? If i do, how do i set it to be the current
    > > windows user logged into the application? I don't want to create a
    > > NetworkCredential object where i would have to pass in the login and
    > > password of the user.
    > >
    > > Thanks,
    > >
    > >

    >
    >
     
    Jamie, Feb 26, 2004
    #3
  4. Jamie

    Jamie Guest

    anybody? :(


    "Jamie" <> wrote in message
    news:uvjPWCM$...
    >
    > Thanks. I tried that and thought it was working.. but it only seems to

    work
    > when i'm on the same system as the webserver. When i go to another system
    > and browse to the web page i get a (401) unauthorized error message.
    >
    > It's currently setup with
    >
    > <identity impersonate="true" /> in web.config
    >
    > IIS - Windows Authentication
    >
    > myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials
    >
    >
    >
    > "richlm" <> wrote in message
    > news:%23JKkLzJ$...
    > > e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;
    > >
    > > Look up System.Net on MSDN library for more info.
    > >
    > > Richard.
    > >
    > > "Jamie" <> wrote in message
    > > news:ONzlvoJ$...
    > > >
    > > > I'm trying to create a HttpWebRequest object that uses the current

    > logged
    > > in
    > > > users credentials. The site is using Windows Authentication, Anonymous
    > > > access is turned off.
    > > >
    > > > Will the HttpWebRequest object use the current users credentials if i

    > use
    > > > <identity impersonate="true" /> ? or do i have to set the Credentials
    > > > property of the web request? If i do, how do i set it to be the

    current
    > > > windows user logged into the application? I don't want to create a
    > > > NetworkCredential object where i would have to pass in the login and
    > > > password of the user.
    > > >
    > > > Thanks,
    > > >
    > > >

    > >
    > >

    >
    >
     
    Jamie, Feb 27, 2004
    #4
  5. Jamie

    Jamie Guest

    anybody? :(


    "Jamie" <> wrote in message
    news:uvjPWCM$...
    >
    > Thanks. I tried that and thought it was working.. but it only seems to

    work
    > when i'm on the same system as the webserver. When i go to another system
    > and browse to the web page i get a (401) unauthorized error message.
    >
    > It's currently setup with
    >
    > <identity impersonate="true" /> in web.config
    >
    > IIS - Windows Authentication
    >
    > myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials
    >
    >
    >
    > "richlm" <> wrote in message
    > news:%23JKkLzJ$...
    > > e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;
    > >
    > > Look up System.Net on MSDN library for more info.
    > >
    > > Richard.
    > >
    > > "Jamie" <> wrote in message
    > > news:ONzlvoJ$...
    > > >
    > > > I'm trying to create a HttpWebRequest object that uses the current

    > logged
    > > in
    > > > users credentials. The site is using Windows Authentication, Anonymous
    > > > access is turned off.
    > > >
    > > > Will the HttpWebRequest object use the current users credentials if i

    > use
    > > > <identity impersonate="true" /> ? or do i have to set the Credentials
    > > > property of the web request? If i do, how do i set it to be the

    current
    > > > windows user logged into the application? I don't want to create a
    > > > NetworkCredential object where i would have to pass in the login and
    > > > password of the user.
    > > >
    > > > Thanks,
    > > >
    > > >

    > >
    > >

    >
    >
     
    Jamie, Mar 1, 2004
    #5
    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. Scott Allen

    Re: httpwebrequest credentials

    Scott Allen, Sep 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,593
    =?Utf-8?B?Q296ZmVy?=
    Sep 27, 2004
  2. =?Utf-8?B?Q296ZmVy?=

    httpwebrequest credentials

    =?Utf-8?B?Q296ZmVy?=, Sep 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,343
    =?Utf-8?B?Q296ZmVy?=
    Sep 21, 2004
  3. msnews.microsoft.com
    Replies:
    0
    Views:
    913
    msnews.microsoft.com
    May 10, 2006
  4. bugnthecode
    Replies:
    5
    Views:
    4,144
    Brandon McCombs
    Feb 8, 2007
  5. moo
    Replies:
    1
    Views:
    8,820
    bruce barker
    Jul 25, 2007
Loading...

Share This Page