I have actually a .NET 2.0 website (VB) to run in mine IIS6 (XP pro SP2) and a .NET 3.5 (configured together .NET2 under IIS"s ASP.NET tab, that course) hosting an ASMX web service.

You are watching: The request failed with http status 401 unauthorized

In Chrome, ns can speak to the ASMX and invoke the internet methods successfully. However, in calling the web methods in code, from the .NET 2.0 website i get:

The request failed v HTTP standing 401: Unauthorized.

How do I get around this?


*

*

You require to set the credentials in you application when you initialise the webService object.

Something prefer webService.UseDefaultCredentials = true

This will set the credentials that the inquiry to the current user executing the application.


*

*

you have the right to use this:

webservice.UseDefaultCredentials = true;if does no work, usage the below code instead of the code above

webservice.Credentials = brand-new NetworkCredential("userName", "password", "domain");webservice.PreAuthenticate = true;note: the username Password and also domain is the user credential that the user that accessibility to webservice

so make certain that user have permission to access to net service

maybe the user is the home windows user

and you can acquire the domain from: right click in "MyComputer" and propertiesthe domain is the computer name or Workgroup


share
follow
reply Jul 27 "16 at 13:56
*

Mohamad ChamiMohamad Chami
1,1561313 silver- badges1010 bronze badges
2
include a comment |
3
In IIS 7, permit anonymous authentication and also you should have the ability to debug.


re-superstructure
monitor
answer Oct 1 "12 in ~ 20:59
Glade MellorGlade Mellor
1,2261616 silver- badges99 bronze badges
include a comment |
3
webService.UseDefaultCredentials = trueThis worked for me.


re-superstructure
monitor
edited Jun 4 "13 at 22:05
summary Algorithm
6,71133 gold badges2929 silver badges4343 bronze badges
answered Jun 4 "13 at 21:44
SinghJiSinghJi
3933 bronze title
include a comment |
0
im am check this way:

CheckListService.CheckList chkSrvice = new CheckListService.CheckList() UseDefaultCredentials = true ;
re-publishing
follow
edited Jun 29 "14 at 4:28
khagler
3,7882626 silver badges3939 bronze badges
answered Jun 29 "14 at 4:08
aliali
1
0
add a comment |

her Answer


thanks for contributing solution to stack Overflow!

Please be certain to answer the question. Administer details and also share her research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based upon opinion; back them increase with references or personal experience.

To learn more, see our advice on writing great answers.

See more: Cheap Flights To Texas From San Diego To Dallas Flights, Find San Diego To Dallas Flights


Draft saved
Draft discarded

Sign increase or log in in


sign up utilizing Google
authorize up making use of Facebook
sign up utilizing Email and Password
submit

Post as a guest


surname
email Required, but never shown


Post together a guest


name
email

Required, but never shown


post Your price Discard

By clicking “Post your Answer”, girlfriend agree to our regards to service, privacy policy and also cookie policy


Not the prize you're looking for? Browse various other questions tagged web-services http-status-code-401 .net-3.5 or ask your very own question.


The Overflow Blog
Featured ~ above Meta
Visit conversation
Linked
-2
Open Azure VM to net for a internet site
associated
539
Maximum length of HTTP get request
3190
403 Forbidden vs 401 not authorised HTTP responses
9
Reporting services 2008: "HTTP standing 401: Unauthorized" concern
0
calling SharePoint Web company over SSL in VB.Net (401 Unauthorized)
14
exactly how to stop IIS7 for dealing with HTTP status code 401?
3
What causes "HTTP status 401: OK"
2
Error call web organization 401: innocuous
0
System.Net.WebException: The request failed through HTTP status 401: innocuous
1
jquery ajax unauthorized request, return "NetworkError" and also status 0
4
The inquiry failed v HTTP condition 401: not authorised - IIS upgrade - WebService & web Application
warm Network concerns more hot inquiries

question feed
i ordered it to RSS
inquiry feed To i ordered it to this RSS feed, copy and paste this URL into your RSS reader.


default
stack Overflow
commodities
agency
ridge Exchange Network
site design / logo © 2021 ridge Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.11.3.40639


Stack Overflow works ideal with JavaScript allowed
*

her privacy

By click “Accept all cookies”, girlfriend agree stack Exchange deserve to store cookies on your maker and disclose details in accordance through our Cookie Policy.