asp.net - Is there a way to pass domain credentials from the originating browser in webHttpBinding wcf service? -


is there way pass domain credentials originating browser in webhttpbinding wcf service? i'm thinking should possible when log aspx page windows authentication enabled in iis, can calling user's domain credentials. how setup wcf service in such manner? user identity in wcf service of app pool svc running under?

edit

i don't have .net 4 -- configuration file below, still error:

security settings service require 'anonymous' authentication not enabled iis application hosts service.

should explicitly enable anonymous path in iis? think undo efforts domain name.

<behaviors> <endpointbehaviors>     <behavior name="awesome.project.operationsbehavior">         <enablewebscript />     </behavior> </endpointbehaviors> </servicebehaviors>     <behavior name="awesome.project.operationsservicebehavior">         <servicemetadata httpgetenabled="true" />         <servicedebug includeexceptiondetailinfaults="false" />     </behavior> </servicebehaviors> </behaviors>  <services>       <service behaviorconfiguration="awesome.project.operationsservicebehavior"         name="awesome.project.operations">         <endpoint address="" binding="webhttpbinding"           contract="awesome.project.operations"           behaviorconfiguration="awesome.project.operationsbehavior"           bindingname="windowssecuritywebhttpbinding">           <identity>             <dns value="localhost" />           </identity>         </endpoint>         <!--<endpoint address="mex" binding="mexhttpbinding"               contract="imetadataexchange" />-->       </service> </services>  <bindings>     <webhttpbinding>         <binding name="windowssecuritywebhttpbinding">             <security mode="transport">                 <transport clientcredentialtype="windows"/>             </security>         </binding>     </webhttpbinding> </bindings> 

you need turn on authentication in service - assuming .net 4 add following config

<bindings>   <webhttpbinding>     <binding>       <security mode="transport">         <transport clientcredentialtype="windows"/>       </security>     </binding>   </webhttpbinding> </bindings> 

for .net 3.5 or 3.0 need

<bindings>   <webhttpbinding>     <binding name="webbindingconfig">       <security mode="transport">         <transport clientcredentialtype="windows"/>       </security>     </binding>   </webhttpbinding> </bindings>  <services>   <service ...>     <endpoint bindingconfiguration = "webbindingconfig" binding="webhttpbinding" .../>   </service> </services> 

edit additional questions:

wcf not pass credentials on non secured transports - that's why mode="transport" important. if got rid of same mode="none" webhttpbinding

if site considered in intranet zone ie pass user's credentials automatically. however, non-ie browsers not , hit site anonymously before getting 401 , sending credentials. intial request requires anonymous access supported in iis wcf handles authentication mechanism

if need hold of httpcontext can use asp.net compatibility. in wcf can use servicesecuritycontext.current.primaryidentity.name authenticated user


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -