472,353 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

HTTPWebRequest, Proxy, Credentials?

moo
Is there a simple way to get my logon credentials to make my web request
work through our proxy server? I tried CredentialCache.DefaultCredentials,
but I get nothing back. I can get it to work if I just create a new
NetworkCredential object specifying user, password and domain. But, I would
rather get that info automatically if possible, rather than presenting a
winform for them to type it in.

Lastly, why do both the request object and the request's proxy object have
properties for credentials? Do I need to populate them both?

Thanks,
// WebRequest
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(anyURL);
webRequest.Timeout = 10000;
webRequest.CookieContainer = cookieContainer;

// Proxy Credentials?
webRequest.Proxy = WebProxy.GetDefaultProxy();
webRequest.Proxy.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");

webRequest.Credentials = CredentialCache.DefaultCredentials;
webRequest.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");

Jul 25 '07 #1
1 3877
the proxy server is a local server used to access the internet, and
generally uses an internal account. the web server may have its own
login requirements and may use the same login (or method). when using a
proxy to access a local server the accounts may match.

CredentialCache.DefaultCredentials is the current threads nt security
token. if it doesn't work then its probably a local account without
network access. for asp.net use a domain pool account, and be sure
impersonation is off.

-- bruce (sqlwork.com)

moo wrote:
Is there a simple way to get my logon credentials to make my web request
work through our proxy server? I tried CredentialCache.DefaultCredentials,
but I get nothing back. I can get it to work if I just create a new
NetworkCredential object specifying user, password and domain. But, I would
rather get that info automatically if possible, rather than presenting a
winform for them to type it in.

Lastly, why do both the request object and the request's proxy object have
properties for credentials? Do I need to populate them both?

Thanks,
// WebRequest
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(anyURL);
webRequest.Timeout = 10000;
webRequest.CookieContainer = cookieContainer;

// Proxy Credentials?
webRequest.Proxy = WebProxy.GetDefaultProxy();
webRequest.Proxy.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");

webRequest.Credentials = CredentialCache.DefaultCredentials;
webRequest.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");


Jul 25 '07 #2

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

Similar topics

15
by: warlord | last post by:
I have a windows client app that is trying to download a file from a web server but I always get the following error when I call the GetResponse...
2
by: Steve Richter | last post by:
I have a page that uses simple HTTP GET to do an ISBN lookup via Amazon.com. The page works when I run it from //localhost. But I have moved it...
3
by: d2005\\ | last post by:
I have a site hosted on GoDaddy's shared platorm. I am trying to read XML from the yahoo RSS feed using the HttpWebRequest.GetResponse method and...
1
by: Imran Aziz | last post by:
Hello All, I am using HttpWebRequest to fetch webpages in my ASP.net C# application. The request works fine without the proxy, but on using the...
1
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the...
8
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the...
4
by: retroviz | last post by:
Hi there. I have written a screen scraping application (both web based and windows forms) in vb.net. When testing on a public broadband link it...
2
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL...
2
by: =?Utf-8?B?TGVuc3Rlcg==?= | last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to request a resource over HTTPS is failing following the installation of...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.