1

I got a ASP.Net webforms app which is using Forms authentication. It needs to authenticate against a webservice which uses windows authentication (+ impersonation).

I've tried (amongst other things) to supply credentials by using:

service.Credentials = new NetworkCredential(myUserName, thePassword, theDomain)

The problem is that I get 401 from the webservice no matter what I try.

2 Answers 2

1

I am doing exactly the same as this (by the sounds of it) and here is the way I construct the credentials.

var service = new MyService();
var netCredential = new NetworkCredential("user", "pwd", "domain");
var credentialCache = new CredentialCache
                          {
                              {new Uri(service.Url), "Basic", netCredential}
                          };
service.Credentials = credentialCache;
Sign up to request clarification or add additional context in comments.

2 Comments

Which authentication methods have you activated in IIS for your webforms app and for your webservice? Which IIS version are you running?
The Web service is hosted on IIS7 and Authentication = Basic and Impersonation = true. The Web App is running on a different server which is also IIS7 and requires Windows Authentication.
0

The problem was that identity that the Application Pool that the Web service run on wasn't allowed to impersonate.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.