domain based webservice connection problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: domain based webservice connection problem

  1. #1
    Join Date
    Jun 2009

    domain based webservice connection problem

    When I try to connect domain based webservice from my system getting "The request failed with HTTP status 401: Unauthorized" error .What could be the problem.

    When i browse the service from browser( i can see the service output but when i try to connect from my below programe getting 401 error.
    Please advice me.

    MyService service= new MyService ();
    System.Net.CredentialCache cache = new System.Net.CredentialCache();
    cache.Add(new Uri(""), new System.Net.NetworkCredential("muusername", "mypwd","mydomain"));
    service.Url = "";
    int cnt = 0;
    myrec[] records = new myrec[0];
    AccRecord oaccRecord = new AccRecord ();

    DateTime enddt = DateTime.Now;
    DateTime stdt = DateTime.Now.AddDays(-10);

    service.Credentials = cache;
    records =service.ReadRecord(records , stdt, enddt);// here taking some time and throwing 401 eroor

  2. #2
    Join Date
    Jan 2006
    Fox Lake, IL

    Re: domain based webservice connection problem

    Please use CODE TAGS
    ' new System.Net.NetworkCredential("muusername", "mypwd","mydomain"));
    I'd guess that the problem might lie in that statement...

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jun 2009

    Re: domain based webservice connection problem

    my guess not code problem when i use same code for other service its working fine but the other service reside on not domain based server.
    so my code like this new System.Net.NetworkCredential("user", "pwd") no domain name.

    only problem with domain based server .
    do i need to do any settings any where?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)