How do I pass user credentials from aspnet site to wcf service?
- Without impersonating. (web site must be executed by a specific user)
- Without knowing the callers password.
- Only passing some kind of mystic security context.
Both开发者_JS百科 website and WCF service use logon with windows/NTLM: authentication mode="Windows"
WCF service using: binding="wsHttpBinding"
IIS 7.5. 2 servers (2008r2).
website code behind (current - passing credentials for user which executes website):
protected void btSend_Click(object sender, EventArgs e)
{
FunctionWhichCanOnlyBeCalledByASpecificUser();
MyService.MyServiceClient s = new MyService.MyServiceClient();
s.SendMyMessage(tbMessage.Text);
}
In many cases you can use ASP.NET Compatibility Mode just add this line to your config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
Reference
精彩评论