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

Discussion in 'ASP .Net Web Services' started by raveesh khosa, Apr 11, 2006.

  1. 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 ***
    raveesh khosa, Apr 11, 2006
    #1
    1. Advertising

  2. raveesh khosa

    Simon Hart Guest

    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" <> wrote in message
    news:...
    >
    >
    > 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 ***
    Simon Hart, Apr 22, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sachin
    Replies:
    2
    Views:
    17,861
    Sachin
    Nov 4, 2005
  2. ad
    Replies:
    2
    Views:
    13,496
  3. ad
    Replies:
    0
    Views:
    1,615
  4. Kevin Burton

    The request failed with HTTP status 401: Unauthorized.

    Kevin Burton, Dec 17, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    143
    Mohamed El Ashmawy
    Dec 19, 2004
  5. Sachin

    The request failed with HTTP status 401: Unauthorized

    Sachin, Nov 4, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    120
    Sachin
    Nov 4, 2005
Loading...

Share This Page