DefaultCredentials and WebClient

C

Colin Bowern

I'm trying to make a call inside an ASP.NET web application to an external
quasi-web service (aka FrontPage Server Extensions):

Dim rpcClient As New WebClient
Dim rpcData As New NameValueCollection
Dim rpcResponseArray As Byte()

rpcData.Add("method", "open service:6.0.2.5530")
rpcClient.Credentials = System.Net.CredentialCache.DefaultCredentials
rpcClient.Headers.Add("X-Vermeer-Content-Type",
"application/x-www-form-urlencoded")
rpcResponseArray = rpcClient.UploadValues(currentSite.Url.ToString() +
"/_vti_bin/_vti_aut/author.dll", rpcData)

The app however, is throwing back a 401 Unauthorized. I've been able to
validate the right context is passing through the app by checking
System.Security.Principal.WindowsIdentity.GetCurrent().Name to see the right
user name. And if I create the credential cache manually, it works:

Dim myCreds As New NetworkCredential("userid", "password", "mydomain")
Dim myCache As New CredentialCache
myCache.Add(New Uri("http://dev.mydomain.net/"), "Basic", myCreds)
rpcClient.Credentials = myCache

Any thoughts on why impersonation wouldn't pass through the right
credentials to teh WebClient class in an ASP.NET web application?

Thanks!
Colin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top