Search code examples
wcfexceptionwcf-bindingnettcpbindingform-authentication

Form Authentication on NetTcpBinding in WCF service


I am using WCF service, which have two endpoint WsHttpBinding and NetTcpBinding and the service is using Forms Authentication. Service is hosted on IIS 7.

This works perfectly with WsHttpBinding, but fails for NetTcpBinding.

It fails on below statement:

FormsAuthentication.SetAuthCookie("COOKIENAME", false);

And the exception is :

Object reference not set to an instance of an object.

Please share your ideas on this.


Solution

  • Forms Authentication requires cookies/session which is not supported by protocol itself. So, Forms authentication can not implemented on NetTcpBinding of WCF service.