Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 07, 2012 11:46 AM by Rama Pillai
Aug 29, 2012 11:58 AM|LINK
I have strange problem. I'm calling my web service, hosted on IIS on local intranet. I have several different client programs, which are calling this web service. All programs has the same code to do this. All programs except 1 are working normaly. This,
the newest 1 is acting strangly. When I click the button, to call the web service, i get an error : The request failed with HTTP status 401: Unauthorized.
When I press the button second time it works normal. And so on till I close the program. Next time is the same, on first try i get an error, then works OK.
Aug 29, 2012 12:24 PM|LINK
See this issue is might be with the "System.Net.CredentialCache.DefaultCredentials"
While making the instance of a Web Service kindly do the mentioned below :-
Your_WS_.WS_Method_Name ws = new Your_WS_.WS_Method_Name();
ws.Credentials = System.Net.CredentialCache.DefaultCredentials;
Hope this will work for you.
Aug 29, 2012 12:51 PM|LINK
tnx for your reply.
I had set ws credentials to DefaultNetworkCredentials, which i guess is the same as DefaultCredentials or am I wrong?
Anyway, I tried also with DefaultCredentials and result is the same.
Dec 07, 2012 11:46 AM|LINK
Did you find a solution for this? I am having the similar issue here.
I know enabling Anonymous access might solve the issue but the 401 error is coming up only first time and the subsequent calls are fine!