401 Error Accessing Web Service
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta accessing web service java Discuss the workings and policies of this site About Us Learn more
Accessing Web Service C#
about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack accessing web server Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping
401 Unauthorized Web Service Call
each other. Join them; it only takes a minute: Sign up Web Service 401: Unauthorized Error up vote 4 down vote favorite I am running a web service locally that connects to an outside server that i do not have access to. I keep receiving the "401: Unauthorized" error even though the test credentials are confirmed exactly 401 unauthorized web service java correct by the admins of this web service. Do i need to adjust any IIS settings? Here is a screenshot of the error. // Webservice IdentityService ws = new IdentityService(); // Test Static Credentials string username = "twfnf"; string password = "testme99"; string domain = "testapps1"; NetworkCredential credentials = new NetworkCredential(username, password, domain); CredentialCache credCache = new CredentialCache(); credCache.Add(new Uri(ws.Url), "Basic", credentials); ws.Credentials = credCache; ws.PreAuthenticate = true; ws.AuthenticateUser(); c# web-services asmx credentials share|improve this question edited Dec 16 '11 at 19:47 John Saunders 138k20175319 asked Dec 15 '11 at 17:55 the sandman 4093726 1 Is IdentityService a SOAP style web service (like WCF web services, by default) or the older .NET 2.0 ASMX web service? –Sean Hanley Dec 15 '11 at 18:01 @Sean - it's SOAP Style –the sandman Dec 15 '11 at 18:08 Could it be that "Basic" is not the auth system used? Basic doesn't use the domain property. If you try to connect to the URI in a browser with the use
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/Advanced ASP.NET/WCF, ASMX and other Web Services/"401 Not Authorized" error when authenticating a web service "401 Not Authorized"
[iss.0088.9164] Access To Wsdescriptor Denied
error when authenticating a web service RSS 9 replies Last post
Web Service Access Denied
Aug 16, 2007 05:12 PM by BigBlueEye ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts 401 unauthorized error web service Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Reply Afro Blanca None 0 Points 104 Posts "401 Not Authorized" error when authenticating a web service Dec 01, http://stackoverflow.com/questions/8524499/web-service-401-unauthorized-error 2006 03:23 PM|Afro Blanca|LINK Here's the situation : I have the same asp.net 2.0 web application running on both Machine A and Machine B. On both machines, I have Integrated Windows Authentication turned on, and Anonymous Access turned off. When I hit a certain page on Machine A, it will call the web service on Machine A, and then http://forums.asp.net/t/1050587.aspx?+401+Not+Authorized+error+when+authenticating+a+web+service it will call the same web service on Machine B. Likewise, when I hit the same page on Machine B, it will call the web service on Machine B, and then it will call the same web service on Machine A. On both machines, I have an account set up for this web service to use. The username/password for Machine A is different from the username/password for Machine B. The machines are on different Active Directory domains. The websites on Machine A and Machine B use the same second-level domain, but have different subdomains. On the page that calls the webservice, I have a block of code that looks like this : try {//call the webservice on Machine A CacheMaintenance maintain = new CacheMaintenance("local.mysite.com"); maintain.Credentials = new NetworkCredential("LocalLoginName", "LocalPassword", "LocalDomain"); maintain.FlashTheCache(); maintain.Dispose(); } catch (Exception exp) { errors = "Could not flash local cache. " + General.UnrollException(exp) + " "; } try {//call the webservice on Machine B CacheMaintenance maintain = new CacheMaintenance("testlive.mysite.com"); maintain.Credentials = new NetworkCrede
One games Xbox 360 games PC https://support.microsoft.com/en-us/kb/811318 games Windows games Windows phone games Entertainment All http://blog.gauffin.org/2012/12/solved-getting-401-unauthorized-while-calling-an-asmx-service-using-windows-authentication/ Entertainment Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security web service Internet Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Band Microsoft accessing web service Lumia All Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States) Terms of use Privacy & cookies Trademarks © 2016 Microsoft
Today I've spent almost the whole day to figure out why an application (COM+) couldn't authenticate against a ASMX web service. Using my favorite networking tools Wireshark and HTTP Fiddler I saw that the credentials didn't get included in the initial request, and no other request was made when the 401 challenge came from the web service. The code was doing something like this: using (client = new MyWebService()) { var credentials = new NetworkCredential(); credentials.Username = ConfigurationManager.AppSettings["WSUserName"] credentials.Password = ConfigurationManager.AppSettings["WSPassword"] credentials.Domain = ConfigurationManager.AppSettings["WSDomain"] client.Credentials = credentials; // .. and the call here .. } That didn't work very well. So I fiddled around with CredentialsCache (trying both "Negotiate" and "NTLM") and using FQDN or just the server name: var cache = new System.Net.CredentialCache(); cache.Add(new Uri("http://srt00428"), "NTLM", new NetworkCredential("SomeName", "SomePassword")); var client = new MyWebService(); client.Credentials = cache; // ..and the call.. That didn't work so well either. Then I tried to assign it directly: var client = new MyWebService(); client.Credentials = new NetworkCredential("SomeName", "SomePassword", "MyDomain") // ..and the call.. Didn't work either. And out of desperation I just tried to use the username/password: var client = new MyWebService(); client.Credentials = new NetworkCredential("SomeName", "SomePassword") // ..and the call.. Voila! It worked. Don't ask me why, but it does. Do note that I couldn't get this to work: using (client = new MyWebService()) { var credentials = new NetworkCredential(); credentials.Username = ConfigurationManager.AppSettings["WSUserName"] credentials.Password = ConfigurationManager.AppSettings["WSPassword"] client.Credentials = credentials; // .. and the call here .. } The username/password HAS to be set in the NetworkCredential constructor.. My final code: using (client = new MyWebService()) { var username = ConfigurationManager.AppSettings["WSUserName"] var password = ConfigurationManager.AppSet