Search code examples
c#visual-studio-2010web-servicesweb-reference

Missing properties when using Web Reference feature in Visual Studio


I am using a .NET Web Reference for consuming a web service that is using basic authentication. In the past I could set the credentials by accessing the same-named property. For example:

MyWebReference.Service1 client = new MyWebReference.Service1();
client.Credentials = new System.Net.NetworkCredential("username", "password");
client.MyOperation();

This worked fine in an older project. Now I am trying to set the Credentials block in a new VS project and I can't find the property anymore. I checked my old project and there were several properties like AllowAutoRedirect, ClientCertificates, ConnectionGroupName, Container, CookieContainer, ...

In my new VS project I just got Url and UseDefaultCredentials. I also included the web service from the older (working) VS project into my new project, but there are no properties either. So it must be something strange with the VS project or there are references missing.

I checked references, recreated the web reference several times but didn't get things working.

I am using Visual Studio 2010 Professional.

Any idea?

Thanks for your help


Solution

  • I resolved the problem by myself. Unfortunately I had added a WCF Service named System.svc to the project map which resulted in a conflict between the System namespace and the class named System

    I renamed the System.svc class and the Credentials-property became accessible.