Valentin V
Valentin V

Reputation: 25759

AJAX and asp.net security question

I have a couple of questions regarding security mechanisms in asp.net (2.0).

I have always been using Forms authentication + Page.User for validating permissions.

Now I need to send some data from client side javaScript (jQuery) to a WCF service. Will my IPrincipal be still accessible from HttpContext of WCF service (I'm hosting my services on same IIS, same domain).

I'm particulary interested if $.Ajax will grab client authentication cookie and assign it to HttpContext on the server (or does it happen automagically)?

What are possible gotchas / pitfalls here?

Thank you.

Upvotes: 0

Views: 154

Answers (1)

Konstantin Tarkus
Konstantin Tarkus

Reputation: 38408

You can, but need to set this property in web.config of your WCF service.

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

Upvotes: 2

Related Questions