473,836 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 .DefaultCredent ials,
but I get nothing back. I can get it to work if I just create a new
NetworkCredenti al 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.Cre ate(anyURL);
webRequest.Time out = 10000;
webRequest.Cook ieContainer = cookieContainer ;

// Proxy Credentials?
webRequest.Prox y = WebProxy.GetDef aultProxy();
webRequest.Prox y.Credentials = new
NetworkCredenti al("XXX","YYY", "ZZZ");

webRequest.Cred entials = CredentialCache .DefaultCredent ials;
webRequest.Cred entials = new
NetworkCredenti al("XXX","YYY", "ZZZ");

Jul 25 '07 #1
1 4006
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 .DefaultCredent ials 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 .DefaultCredent ials,
but I get nothing back. I can get it to work if I just create a new
NetworkCredenti al 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.Cre ate(anyURL);
webRequest.Time out = 10000;
webRequest.Cook ieContainer = cookieContainer ;

// Proxy Credentials?
webRequest.Prox y = WebProxy.GetDef aultProxy();
webRequest.Prox y.Credentials = new
NetworkCredenti al("XXX","YYY", "ZZZ");

webRequest.Cred entials = CredentialCache .DefaultCredent ials;
webRequest.Cred entials = new
NetworkCredenti al("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
515
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 method of the Request object. The remote server returned an error: (404) Not Found. When I run it against a website on my local machine everything works perfectly, but not against the remote server. I'm sure it's a security or permissions problem of some sort, but I'm not sure where to start.
2
14101
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 to my godaddy.com shared hoster site, and I get errors on the HttpWebRequest.GetResponse statement. The remote server returned an error: (401) Unauthorized also, when I use the network credentials object in the context of my request, I get this error:
3
3226
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 am getting a "401 access denied" exception. I have seen posts here before that indicate GoDaddy needs to provide a proxy to allow this to work properly. They claim this is not the case and want me to open a trouble ticket with their advanced support (this could cost money!).
1
12311
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 code from within a network that uses proxy the request does not work. I tried to use the MS code to get around it, but having problems using it. The first thing is that the this conversion myProxy=(WebProxy)myWebRequest.Proxy; does not work, and I get an error of cannot convert...
1
2363
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 html for the logon user's default page. We've accomplished this in the past utilizing the ServerXMLHTTP object. When I try an equivalent? post utilizing the HttpWebRequest class, the response contains the html for logon.asp (the same page that was posted to), which indicates to me that in some...
8
3957
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 html for the logon user's default page. We've accomplished this in the past utilizing the ServerXMLHTTP object. When I try an equivalent? post utilizing the HttpWebRequest class, the response contains the html for logon.asp (the same page that was posted to), which indicates to me that in some...
4
9660
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 works fine. However it fails at work due to our proxy server. To authenticate in the asp version, I just added: <defaultProxy useDefaultCredentials="true"> to my web.config - this works fine. However, I need to integrate this with an existing windows form app (vb6) so need to get the...
2
3493
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 and through a proxy server after using the HttpWebRequest object. Under normal circumstances I am able to use the webservice without any problems. But after using an HttpWebRequest object to make a call to a website all subsequent attempts to use the WebService will fail with a 401...
2
8189
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 a new proxy server on our internal network with 407 Proxy Authentication Required. The same request through the old proxy succeeds. The same request to an HTTP address through the new proxy succeeds. Also, the request succeeds when forced to use Basic authentication but fails on NTLM.
0
9827
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10862
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10560
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10607
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6986
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5838
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.