WCF CustomBinding and Http Cookie, any luck?  
Author Message
Pi314159





PostPosted: Windows Communication Foundation ("Indigo"), WCF CustomBinding and Http Cookie, any luck? Top

Is it possible to hook up HTTP cookie somewhere in the Custom Binding stack

Due to the specifications I was given, I have to store some Security Tokens in HTTP cookie. This sounds strange but it is a requirement.

Thank you for replying.




Visual Studio 200827  
 
 
Ed Pinto - MSFT





PostPosted: Windows Communication Foundation ("Indigo"), WCF CustomBinding and Http Cookie, any luck? Top

You can manipulate cookies in WCF by accessing HttpRequestMessageProperty.Headers or the mirror property on HttpResponseMessageProperty. This sample shows how to write a channel that uses cookies (and how to wire up that channel in a custom binding).

Cheers,

Ed


 
 
Pi314159





PostPosted: Windows Communication Foundation ("Indigo"), WCF CustomBinding and Http Cookie, any luck? Top

From the sample,it seems like Channel Layer and Service Implementation Layer are totally seperated. What I have to do is to expose an authentication web service that accepts username and password and give out a random ticket ID in a cookie. Then the client can use this cookie to access other web services.

There are 2 problems here:-

1. If I implement the authentication web service, I cannot access cookies from the service implementation layer. This is a problem because after the username/password have been validated, I have to save the randomly generated ticket ID that is given as a cookie back to the database but I cannot access the cookie from this layer.

2. If the authentication service can be achieved, now from Channel Layer I have to enforce the access control which is based on the supplied ticket ID in the cookie validated against the available ticket ID in the database. This is mixing up database access with Channel Layer which I think is not a good practice.

Anyone having suggestions, or a solution please help!!!!