Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

HTTPWebRequest, Proxy, Credentials?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
moo - 25 Jul 2007 06:15 GMT
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");
bruce barker - 25 Jul 2007 16:48 GMT
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)

> Is there a simple way to get my logon credentials to make my web request
> work through our proxy server? I tried CredentialCache.DefaultCredentials,
[quoted text clipped - 22 lines]
>                 webRequest.Credentials = new
> NetworkCredential("XXX","YYY","ZZZ");

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.