Can WebSecurity work in WCF services?

I am new to the SimpleMembership model. WebSecurity works fine on web pages, but I have problems when I use it in services.

I have several web services running under:

<binding name="SecureBasicBindingWithMembershipConfig"> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="None" /> <message clientCredentialType="UserName" /> </security> </binding> 

I am trying to recover a user id from a web service.

If I use WebSecurity.IsAuthenticated , it returns IsAuthenticated = 'WebMatrix.WebData.WebSecurity.IsAuthenticated' threw an exception of type 'System.ArgumentNullException'

However, using System.Web.Security.Membership.GetUser() , the user ID is correctly returned.

Can WebSecurity be used in the WCF service or am I doing something wrong?

+4
source share

Source: https://habr.com/ru/post/1479775/


All Articles