473,386 Members | 1,752 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.

System.Net.CredentialCache.DefaultCredentials are blank

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
1 4297
TRScheel
638 Expert 512MB
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

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

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
0
by: Steve Ng | last post by:
Hello, 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...
0
by: Craig | last post by:
We have an anonymous web application trying to talk to a windows authenticated webservice. This is currently failing with 401 Access Denied errors. We have found that we can get this to work by...
0
by: JOS | last post by:
Hi, I have a web application with the following in the web.config file 1 <authentication mode="Windows" /> 2 <identity impersonate="true" /> My IIS settings are shown below ...
0
by: ndskim | last post by:
Currently I have the Web Services Proxy code generated by the WSDL.Exe command line. My Web app consists of ASP.NET in VB 2005 version. Here is what I have in the sample code: ' Set Proxy...
0
by: Joerg Lueders | last post by:
Hi, I created simple code to get information from a Web Service. I need to pass credentials for the Web Service as well as for the Proxy Server (static address). This works fine as long as...
11
by: ckb | last post by:
Hi, I have an active x ctrl on my page and using asp.net I i have built a web page that has a web service named e1.I am using CreateSessionImpersonated() but it does not Impersonate and every time...
2
by: J055 | last post by:
Hi I'm using the following code to get a response froma server which uses IIS6 and Integrated Security. I don't understand where the credentials are stored on the client, i.e. the Visual Studio...
3
sid0404
by: sid0404 | last post by:
Hi I am new to the programming in c#, I have an application where I need to get data from a website now I am getting an error message if I give the input as two strings, say Sun Microsystems while...
5
by: Henry Stock | last post by:
I am trying to understand the following error: Any thing you can tell me about this is appreciated. Security Exception Description: The application attempted to perform an operation not allowed...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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,...
0
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...

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.