By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,655 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,655 IT Pros & Developers. It's quick & easy.

System.Net.CredentialCache.DefaultCredentials are blank

P: 1
I have a windows form application that needs to pass through a proxy
to get access to the internet. As a test, I have successfully
hardcoded my login/password/domain combination and been able to gain
access through the proxy.

I would like to ditch the hardcoded login/password/domain combination
and use the settings defined in Internet Explorer. I've read that I
can use System.Net.CredentialCache.DefaultCredentials to get the
credentials of the machine that the application is running from. When
I try this, all the fields in DefaultCredentials are blank and of
course I get denied access through the proxy.

Any clues to what I'm doing wrong or what would cause the
DefaultCredentials to be blank? I've duplicated the behaviour on two
machines, both running XP SP1. Here's an excerpt of my code ...


this.Credentials = System.Net.CredentialCache.DefaultCredentials;
this.Timeout = 900000;
try
{
this.Proxy = GlobalProxySelection.GetEmptyWebProxy();
this.GetConnectionStatus();
}
catch (Exception)
{
this.Proxy = System.Net.WebProxy.GetDefaultProxy();
}
Apr 25 '07 #1
Share this Question
Share on Google+
1 Reply


TRScheel
Expert 100+
P: 638
I have a windows form application that needs to pass through a proxy
to get access to the internet. As a test, I have successfully
hardcoded my login/password/domain combination and been able to gain
access through the proxy.

I would like to ditch the hardcoded login/password/domain combination
and use the settings defined in Internet Explorer. I've read that I
can use System.Net.CredentialCache.DefaultCredentials to get the
credentials of the machine that the application is running from. When
I try this, all the fields in DefaultCredentials are blank and of
course I get denied access through the proxy.

Any clues to what I'm doing wrong or what would cause the
DefaultCredentials to be blank? I've duplicated the behaviour on two
machines, both running XP SP1. Here's an excerpt of my code ...


this.Credentials = System.Net.CredentialCache.DefaultCredentials;
this.Timeout = 900000;
try
{
this.Proxy = GlobalProxySelection.GetEmptyWebProxy();
this.GetConnectionStatus();
}
catch (Exception)
{
this.Proxy = System.Net.WebProxy.GetDefaultProxy();
}
Using DefaultCredentials is only a good idea if you want to make a web app that runs like a desktop app... least ways, imho
Apr 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.