403: Forbidden exception

  • Thread starter Giulio Petrucci
  • Start date

Giulio Petrucci

Hi there,

I'm traying to consume a web service over an https:// connection (see
some threads before ;-) ), and I got it:

The request failed with HTTP status 403: Forbidden.
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)

Is this because I need to authenticate with username and password? Or is
because of som certificate-related issue?

In the first case (authentication), should I use the following?

Service proxy = new Service(); //new web service proxy instance;
string username = ConfigurationManager.AppSettings["Username"]; //read
username from the config file
string password = ConfigurationManager.AppSettings["Password"]; //read
password from the config file
System.Net.NetworkCredential credentials = new
System.Net.NetworkCredential(username, password);
proxy.Credentials = credentials;

Thanks in advance,
Giulio - Italia

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question