![]() |
Web Service Error: “The request failed with HTTP status 401: Unauthorized
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 *** Sent via Developersdex http://www.developersdex.com *** |
Re: Web Service Error: "The request failed with HTTP status 401: Unauthorized
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. "raveesh khosa" <raveesh_khosa@yahoo.com> wrote in message news:e2lLWrWXGHA.2376@TK2MSFTNGP03.phx.gbl... > > > 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 > > *** Sent via Developersdex http://www.developersdex.com *** |
| All times are GMT. The time now is 08:54 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.