开发者

Passing a cookie to a wcf service

I have a bunch of wcf webhttp (rest) services that expect an auth cookie. Question is - How do I pass the formsauth ticket to the wcf service? Flowing authentication works for get requests through the browsers just fine (as it should) but I am not sure how to set the cookie during my calls using httpclient or webchannelfactory. At this point the authentication is done and the cookie is available. I am not sure of where to insert the cookies while invoking the service through a HttpClient.

HttpClient client = new HttpClient();
HttpContent content = 
    HttpContentExtensions.CreateDataContract<EmployeeData>(MyEmployee);
resp = client.Post("htt开发者_Go百科p://localhost/someservice", content);

I also tried to use the webchannelfactory as per the following url - http://zamd.net/2009/03/05/flowing-forms-authentication-cookie-to-wcf/

However, var identity = Thread.CurrentPrincipal.Identity as ClientFormsIdentity; returns a null even though the Thread.CurrentPrincipal.Identity is a valid FormsIdentity. Any suggestions would be greatly helpful.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜