Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Another HTTP Error status 401 problem!!

Reply
Thread Tools

Another HTTP Error status 401 problem!!

 
 
Dale
Guest
Posts: n/a
 
      07-13-2004
I know (or certainly think I remember) that this was working last time I
looked but when I deployed a new version of my project to the development
web server, suddenly I seem to have forgotten everything I knew about web
services authentication. Every attempt to use the service results in a 401
error. I am running the app from IE on my pc, the web server is on another
box, and the web service runs on a third box. Both server boxes run in a
clustered environment.

I have made sure that:

1. anonymous access is off to the ASP.Net and the web services applications
2. <identity impersonate="true"> is on both web.config files
3. in theASP app, I have the line: myService.Credentials =
System.Net.CredentialCache.DefaultCredentials;

I have even tried making a simple client for the default HelloWorld service,
putting them both in the same folder on the web services server, and I get
the same 401 error. The only way to get around the error is enable
anonymous access but then, of course, my code doesn't work because I have no
User.Identity information where I need it for authorization.

What am I missing?

Thanks in advance!

Dale


 
Reply With Quote
 
 
 
 
Dale
Guest
Posts: n/a
 
      07-15-2004
Fixed!!! What a strange one. I didn't realize how significant the
clustering was going to be when I mentioned it in the inital posting.

I don't have all the specific details but what happened is this: The
infrastructure people replaced some load-balancing equipment with a new
Cisco product. Apparently a known issue with this Cisco product is that it
causes the user identity to get lost in a web request. Because I am a
contractor, the infratsructure people didn't know who I was and I didn't see
the email they sent out.

The solution was to create a System.Net.CookieContainer object and assign it
to the CookieContainer property of the web service proxy like this:

// These two lines of code were the fix:
System.Net.CookieContainer cookies = new System.Net.CookieContainer();
myServiceProxy.CookieContainer = cookies;

//and then add the more expected lines:
myServce.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
myService.Proxy.PreAuthenticate = true;

Though not a single item I could find online or on MSDN would give any
indication at all that the CookieContainer property would be used for web
service authentication, and I still don't know the details or internals of
why it is needed, I do know it fixed my elusive Status 401 problem. Perhaps
it will fix yours as well.

Dale


"Dale" <> wrote in message
news:#...
> I know (or certainly think I remember) that this was working last time I
> looked but when I deployed a new version of my project to the development
> web server, suddenly I seem to have forgotten everything I knew about web
> services authentication. Every attempt to use the service results in a

401
> error. I am running the app from IE on my pc, the web server is on

another
> box, and the web service runs on a third box. Both server boxes run in a
> clustered environment.
>
> I have made sure that:
>
> 1. anonymous access is off to the ASP.Net and the web services

applications
> 2. <identity impersonate="true"> is on both web.config files
> 3. in theASP app, I have the line: myService.Credentials =
> System.Net.CredentialCache.DefaultCredentials;
>
> I have even tried making a simple client for the default HelloWorld

service,
> putting them both in the same folder on the web services server, and I get
> the same 401 error. The only way to get around the error is enable
> anonymous access but then, of course, my code doesn't work because I have

no
> User.Identity information where I need it for authorization.
>
> What am I missing?
>
> Thanks in advance!
>
> Dale
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service Error: “The request failed with HTTP status 401: Unauthorized raveesh khosa ASP .Net Web Services 1 04-22-2006 08:40 PM
The request failed with HTTP status 401: Unauthorized ad ASP .Net 2 02-18-2006 12:11 AM
The request failed with HTTP status 401: Unauthorized ad ASP .Net 0 02-17-2006 06:14 AM
The request failed with HTTP status 401: Unauthorized Sachin ASP .Net 2 11-04-2005 09:15 PM
HttpWebRequest & (401) Unauthorized http status code =?Utf-8?B?UG1jZw==?= ASP .Net 0 06-21-2004 12:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57