none
401: Authorization Required RRS feed

  • Question

  •  

    Hello Forum,

    Here is something I have been struggling for very long now.

    I have got a Windows Application which talks to a HTTPS web service.

    When I run my Windows application in Debug mode, it gives me an error "The request failed with HTTP status 401: Authorization Required."

    Further details include it being something like a WebException.ProtocolError.

    But, the code works fine as a compiled EXE.

    Also, if I create a package for this application and then deploy the machine on a machine other than the development machine, it gives an error saying "The underlying connection was closed: An unexpected error occurred on a send."

    ###########################################################################

    public ServiceHelper(string url,bool useNTLMAuthSvc)

    {

    m_service.Url = url;

    m_service.Timeout = System.Threading.Timeout.Infinite;

    m_service.Credentials = new System.Net.NetworkCredential ("Administrator","Password","Domain"); //System.Net.CredentialCache.DefaultCredentials;

    m_service.PreAuthenticate = true;

    //m_bUseNTLMAuthService = useNTLMAuthSvc;

    }

    The error occurs at the following function;

    public LookupResponseType DoLookup(LookupRequestType request)

    {

    return m_service.LookUpRequest(request);

    }

    ###########################################################################

    I hope this is the right place to raise this issue.

    If not, please feel free to redirect me to some other forum.

    Best Regards,

    - Ajay Kumar Suri

    Thursday, September 7, 2006 4:29 PM