473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Setting HttpWebRequest Credentials to be current user


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,
Nov 18 '05 #1
4 12413
e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;

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

Richard.

"Jamie" <sp**********@nospam.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...

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,

Nov 18 '05 #2

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" <ri*****@h0tmai1.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;

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

Richard.

"Jamie" <sp**********@nospam.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...

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,


Nov 18 '05 #3
anybody? :(
"Jamie" <sp**********@nospam.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...

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" <ri*****@h0tmai1.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;

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

Richard.

"Jamie" <sp**********@nospam.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...

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,



Nov 18 '05 #4
anybody? :(
"Jamie" <sp**********@nospam.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...

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" <ri*****@h0tmai1.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
e.g. myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;

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

Richard.

"Jamie" <sp**********@nospam.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...

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,



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bill Struve | last post by:
Need: Auto-logon to a terminal server, start a program, and, when the user is quits the program, auto-logoff. Done so far: Able to use a fixed username/password in a C# program using AxMSTSCLib...
0
by: Cozfer | last post by:
I am having a problem communicating with a remote server (on intranet) using the httpwebrequest object. We have used the object to communicate with other machines previously, but this time we must...
1
by: TheBurgerMan | last post by:
I have an ASP.NET/C# web site that the user has logged into using my own logon page. How do I set the current web request to use the credentials the user has just provided? -- Thanks,...
3
by: John Dalberg | last post by:
I am setting the HttpContext.Current.User in the Application_AuthenticateRequest event in global.asax.cs. When I use the IsInRole function in a web page, it works fine. So far so good. (Note that...
6
by: Sjaakie | last post by:
Hi, Is HttpContext.Current.User unique for each visitor or is it shared across an application? Have some problems that might have to do with this and found contradictory answers on this...
1
by: ranju | last post by:
I am trying to spawn a process (say an exe file) with different user crendentials than that of the current user. 1) Called LogonUserEx() to logon the user and recieve a handle to the token that...
6
by: theinvisibleGhost | last post by:
Is there a method of determining which format the short date format is stored in for the current user on the machine using .NET? If it is not in UK format I ideally need to be able to set it to...
13
by: bproddu | last post by:
Hi, I'm using Forms authentication for my web app. I've a custom Principal class that I would like to set to the HttpContext.Current.User after the Membership.ValidateUser() passes. I'm able to...
1
by: Nikky85 | last post by:
Hi, I am trying to configure one http module(a vb module) on MOSS site. In this module I have entry like below: Dim roles As String() = Nothing Dim webIdentity As New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.