开发者

Adding Soap Message Header for every request in WCF?

开发者 https://www.devze.com 2023-01-08 03:53 出处:网络
In my old asmx web servicesI used to have AuthHeader which contains the UserName & password and the AuthHeader is mandatory for every web method request. User will send his username & passwor

In my old asmx web services I used to have AuthHeader which contains the UserName & password and the AuthHeader is mandatory for every web method request. User will send his username & password using this AuthHeader and I will validate the request with the Username & password.

How can I ahie开发者_运维知识库ve the samething with WCF as webservice hosting in IIS with basicHttpBinding binding? Is there any way to make user mandatory to send AuthHeader with username & password?

,

nRk


You can uSe below code to pass username and password:

proxy.ClientCredentials.UserName.UserName = "testuser";
proxy.ClientCredentials.UserName.Password = "Password10";

And you need to set the security mode as transport.


Please see if below link helps you out:

Use Username Authentication with Transport Security in WCF

0

精彩评论

暂无评论...
验证码 换一张
取 消