简体   繁体   English

ASP.Net Webforms应用程序和ASP.Net Web服务之间的身份验证问题

[英]Authentication problem between ASP.Net Webforms app and a ASP.Net webservice

I got a ASP.Net webforms app which is using Forms authentication. 我有一个使用Forms身份验证的ASP.Net Webforms应用程序。 It needs to authenticate against a webservice which uses windows authentication (+ impersonation). 它需要针对使用Windows身份验证(+模拟)的Web服务进行身份验证。

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. 问题是无论尝试什么,我都将从Web服务获取401。

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;

问题是不允许模拟运行Web服务的应用程序池的身份。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM