开发者

Secure IIS hosted WCF service for access via IE hosted WinForms User Control

开发者 https://www.devze.com 2023-02-08 16:29 出处:网络
I have an ASP.Net site usin开发者_运维技巧g Forms authentication. One of the aspx pages loads a WinForms user control hosted in IE. That control must connect with a WCF service located in the same ASP

I have an ASP.Net site usin开发者_运维技巧g Forms authentication. One of the aspx pages loads a WinForms user control hosted in IE. That control must connect with a WCF service located in the same ASP.Net web site.

How can I make the WCF service secure? Currently I have set the WCF service to use AspNetCompatibilityRequirements mode but the user control hosted in IE can't connect to the WCF service as it isn't logged in.

Basically I need to extract the user credentials from the aspx page and set them on the user control so that it can log in to the WCF service.

Is this possible? Or is there a better way?


I think this answer probably has everything you need: Passing FormsAuthentication cookie to a WCF service. You just need to pass the authentication cookie to your control when you instantiate it.

As to there being a better way, I personally wouldn't host a WinForms control inside IE. If I were shooting for what was easiest I'd go with Silverlight. If that isn't possible I would make the web service non-soap and use JQuery.

0

精彩评论

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