Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2006, 12:15 AM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default request failed with HTTP status 401: Unauthorized

hi,

I am facing problem when i host my ASP.net application on windows-2003 server.My application is making use of web-services hosted on the same machine.When i call any method of web-servce I get this message:

System.Net.WebException: The request failed with HTTP status 401: Unauthorized. at System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String methodName, Object[] parameters)

I think web-service is not allowing my application to access any of its method.This application and web-service are working fine on other machine where i have XP Professional(OS).

On Windows-2003 server,I have already checked that ISUSR_MachineName user is created.Don't understand why this error is comingPlease help me.

__________________
Regards,
Deepti
 
Old July 19th, 2006, 01:12 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Do you pass any credentials to your web service?

Regards
Ganesh
http://ganeshprof.blogspot.com
 
Old July 19th, 2006, 02:32 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Hope this one helps

http://ganeshprof.blogspot.com/2006/...y-passing.html

Regards
Ganesh
http://ganeshprof.blogspot.com
 
Old July 19th, 2006, 06:03 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Not working means? r u not able to get the link or the contents is not working?? Please reply to forms and not to individuals so that others can also see

Regards
Ganesh
http://ganeshprof.blogspot.com
 
Old July 19th, 2006, 11:10 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

link is not working.
It is not opening the page.

 
Old July 19th, 2006, 11:54 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

public static MyWS.MyWSMethod GetMyWSMethod()
{
MyWS.MyWSMethod WS = new MyWS.MyWSMethod();
WS.Url = System.Configuration.ConfigurationSettings.AppSett ings["MyWSURL"];
WS.PreAuthenticate = false;
WS.Credentials = System.Net.CredentialCache.DefaultCredentials;
return WS;
}

Regards
Ganesh
http://ganeshprof.blogspot.com
 
Old July 20th, 2006, 01:42 AM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks,this line of code helped me to fix the error:)

 
Old July 20th, 2006, 01:57 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

It probably didnt work because there is some issue in BlogSpot blogs..will become alright in another couple of days

Regards
Ganesh
http://ganeshprof.blogspot.com
 
Old July 20th, 2006, 01:59 AM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can u tell me what these lines do:

WS.PreAuthenticate = false;
WS.Credentials = System.Net.CredentialCache.DefaultCredentials;

One more thing,I forgot to tell in my web service class constructor I have made PreAuthenticate=true not false.This happened by mistake but still it worked out.

Pls explain me the functionality.I would be thankfull to you.



 
Old July 20th, 2006, 03:22 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

When PreAuthenticate = true, the WWW-authenticate header is sent with the first request if the authentication mechanism supports doing so. When PreAuthenticate = false, a request is made to the XML Web service method without initially attempting to authenticate the user. If the XML Web service allows anonymous access, then the XML Web service method is executed. If anonymous access is disallowed, a 401 HTTP return code is sent back to the client.

Regards
Ganesh
http://ganeshprof.blogspot.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP Status 404 rivcam JSP Basics 7 June 3rd, 2008 09:32 PM
IIS Basic authentication problem -401 Unauthorized bruceaflash BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 14th, 2005 08:28 AM
The request failed with HTTP status 401: Unauthori CBS .NET Web Services 3 November 30th, 2004 10:07 AM
HTTP Status 405 - HTTP method GET .... nsakic Servlets 1 January 25th, 2004 04:50 PM
HTTP status 404 brianjs JSP Basics 2 October 26th, 2003 03:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.