Web Service Error: “The request failed with HTTP status 401: Unauthorized

R

raveesh khosa

i have made the client side NWClientForm.cs and its code is as given
below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace NWClient
{
public partial class NWClientForm : Form
{
public NWClientForm()
{
InitializeComponent();
}

private NWWebSite.NWWebService service = new
NWWebSite.NWWebService();






private void getButton_Click_1(object sender, EventArgs e)
{
dataGridView1.DataSource = service.GetProducts();
dataGridView1.DataMember = "My Products";
}

}
}


i am getting the HTTP sattus 401:unauthorized error...

can someone pls tell the exact piece of code to be incorporated
considering that the web service is intended to require authentication
and not anonymous access..pls reply pronto...sos
 
S

Simon Hart

Hi,

Try setting the service.Credentials property with a valid
System.Net.NetworkCredential object which specifies the valid user and user
password.

Regards,
Simon Hart.
 

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

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top