The request failed with HTTP status 401: Unauthorized

Discussion in 'ASP .Net Web Services' started by manika02, Mar 29, 2006.

  1. manika02

    manika02 Guest

    Hi,
    I get the following eror when I try to call my WebService (on the local
    machine) using another Web application (on the local machine)

    System.Net.WebException: The request failed with HTTP status 401: Unauthorized

    Any insights on this would be helpful.

    Thanks
    manika02, Mar 29, 2006
    #1
    1. Advertising

  2. manika02

    Scott M. Guest

    The web service you are attempting to access requires that the caller
    provide its credentials to prove that it should be allowed to access the web
    service. You can use this code to send the "default credentials" to the web
    service:

    Dim myProxy As New localhost.Service1()
    myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials

    "manika02" <> wrote in message
    news:...
    > Hi,
    > I get the following eror when I try to call my WebService (on the local
    > machine) using another Web application (on the local machine)
    >
    > System.Net.WebException: The request failed with HTTP status 401:
    > Unauthorized
    >
    > Any insights on this would be helpful.
    >
    > Thanks
    >
    >
    >
    >
    Scott M., Mar 29, 2006
    #2
    1. Advertising

  3. manika02

    Josh Twist Guest

    Also, If you're not interested in using Windows Authentication in IIS
    to secure your web service you can just turn Anonymous Authentication
    on for your web service's Virtual Directory:

    - Right click on the virtual directory in IIS
    - Choose properties from the context menu
    - Select the Directory Security Tab
    - Click the Edit button in the Anonymous access and authentication
    control
    - Check the anonymous access box
    Josh Twist, Mar 30, 2006
    #3
  4. manika02

    BigJohn Guest

    I am getting the same problem running on Windows XP Pro with the anonymous
    auth.

    "Josh Twist" wrote:

    > Also, If you're not interested in using Windows Authentication in IIS
    > to secure your web service you can just turn Anonymous Authentication
    > on for your web service's Virtual Directory:
    >
    > - Right click on the virtual directory in IIS
    > - Choose properties from the context menu
    > - Select the Directory Security Tab
    > - Click the Edit button in the Anonymous access and authentication
    > control
    > - Check the anonymous access box
    >
    >
    BigJohn, Apr 5, 2006
    #4
  5. manika02

    BigJohn Guest

    I tried this method and Josh's (set web service with anonymous auth) and
    cannot bet either to funtion. I am running on Windows XP Pro, all modules
    are within same solution.


    "Scott M." wrote:

    > The web service you are attempting to access requires that the caller
    > provide its credentials to prove that it should be allowed to access the web
    > service. You can use this code to send the "default credentials" to the web
    > service:
    >
    > Dim myProxy As New localhost.Service1()
    > myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
    >
    > "manika02" <> wrote in message
    > news:...
    > > Hi,
    > > I get the following eror when I try to call my WebService (on the local
    > > machine) using another Web application (on the local machine)
    > >
    > > System.Net.WebException: The request failed with HTTP status 401:
    > > Unauthorized
    > >
    > > Any insights on this would be helpful.
    > >
    > > Thanks
    > >
    > >
    > >
    > >

    >
    >
    >
    BigJohn, Apr 5, 2006
    #5
  6. manika02

    Scott M. Guest

    Please show the code you are using to create the web service instance.



    "BigJohn" <> wrote in message
    news:...
    >I tried this method and Josh's (set web service with anonymous auth) and
    > cannot bet either to funtion. I am running on Windows XP Pro, all modules
    > are within same solution.
    >
    >
    > "Scott M." wrote:
    >
    >> The web service you are attempting to access requires that the caller
    >> provide its credentials to prove that it should be allowed to access the
    >> web
    >> service. You can use this code to send the "default credentials" to the
    >> web
    >> service:
    >>
    >> Dim myProxy As New localhost.Service1()
    >> myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
    >>
    >> "manika02" <> wrote in message
    >> news:...
    >> > Hi,
    >> > I get the following eror when I try to call my WebService (on the local
    >> > machine) using another Web application (on the local machine)
    >> >
    >> > System.Net.WebException: The request failed with HTTP status 401:
    >> > Unauthorized
    >> >
    >> > Any insights on this would be helpful.
    >> >
    >> > Thanks
    >> >
    >> >
    >> >
    >> >

    >>
    >>
    >>
    Scott M., Apr 6, 2006
    #6
  7. manika02

    geyser hi Guest

    It works for me (c#). Thanks a lot.

    localhost.Service1 ws=new localhost.Service1();
    ws.Credentials = System.Net.CredentialCache.DefaultCredentials ;
    textBox1.Text=ws.HelloWorld();


    *** Sent via Developersdex http://www.developersdex.com ***
    geyser hi, Apr 10, 2006
    #7
  8. manika02

    geyser hi Guest

    Thanks. The code works for me (C#)

    localhost.Service1 ws=new localhost.Service1();
    ws.Credentials = System.Net.CredentialCache.DefaultCredentials ;

    textBox1.Text=ws.HelloWorld();



    *** Sent via Developersdex http://www.developersdex.com ***
    geyser hi, Apr 10, 2006
    #8
    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,884
    Sachin
    Nov 4, 2005
  2. ad
    Replies:
    2
    Views:
    13,511
  3. ad
    Replies:
    0
    Views:
    1,618
  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:
    147
    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:
    128
    Sachin
    Nov 4, 2005
Loading...

Share This Page