Thanks for your respones John,
As for the further question you mentioned, here are my understandings:
1. YES, IE will automatically send the current logon session's credential
when accessing trusted or intranet zone sites and
anonymous access is not allowed. We can also verfify this in the IE's
Tools---->Internet Options--->Security---->certain Zone ---> Custom Level
setting---> UserAuthenticat ion. Logon
2.When using HttpWebRequest, it has nothing related to IE setting. So we
will always need to manually provide the credential when accessing remote
resouce when require authentication. And yes, the
System.Net. CredentialCache .DefaultCredent ials contains the current logon
user's credential (in winform or console app), but if this credential is
not valid on the remote server, the request will also fail. Different from
IE( IE will popup authentication dialog to let us input username/password
when current user is not valid on remote server), using httpwebrequest ,
there is no such dialog.
So as for your scenario, I think the problem is your current logon user is
not a valid account on the remote server. Is your logon user account a
local account on the machine where you running the httpwebrequest app? If
so, this account is not valid to the remote server, you need to provide a
valid account on the remote server , this account can be either of :
1. A domain account
2. A duplicated local account which has same username/password on both
client and server machine.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)