How to use authentication cookie from WCF Authentication Service in an ASP.Net MVC application

By : tap

Okay, I've had little luck finding any documentation or tutorials for my specific scenario.

I have an ASP.Net MVC web application that will be using WCF services for everything including authentication and roles (via membership providers on the WCF backend).

I've had no problem setting up the authentication services but it does not set a cookie in the web app. The docs for the Login method of the service indicate that wiring up the CreatingCookie Event is possible, but it does not have any affect on the client (I tried on the service side as well, again no affect). So I figured out how to capture the cookie. I have tried to manually set the auth cookie on the client, but so far it is not working; decrypting fails due to padding, and setting the cookie value from the one given by the server is not readable by the client.

Does anybody know how you are supposed to use the cookie that is generated by the WCF Authentication Service? Do I just assume the session is all managed on the WCF server and just check IsLoggedIn() on the service at every page load?

Thanks in advance.

By : tap


This works for me... First setup the authentication behavior of the host (here shown through code, but can also be done in config):

ServiceAuthorizationBehavior author = Description.Behaviors.Find
By : Cine

This video can help you solving your question :)
By: admin