Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Authentication Service Proxy - CookieContainer not available
    text
    copied!<p>I have enabled the ASP.Net authentication service, as recommended by msdn. I am then attempting to use the service via a console app or winforms app (by adding a service reference to my local WCF service). I am doing custom authentication and transport security (so I am handling the <code>AuthenticationService.Authenticating</code> event in my <code>Global.asax</code> which works fine).</p> <p>The authentication itself works fine, but the proxy created by adding the Service Reference does not include the <code>CookieContainer</code> property. This is obviously a problem when I try to pass the cookie token to subsequent services which require authentication.</p> <p>Also, in the following client code, the <code>IsLoggedIn()</code> returns false, I'm guessing this is related to no cookie container being present.</p> <pre><code>ServiceReference1.AuthenticationServiceClient client = new ServiceReference1.AuthenticationServiceClient(); bool isLoggedIn = client.Login("test", "test", "", true); //returns TRUE bool check = client.IsLoggedIn(); //returns FALSE </code></pre> <p>Here is my web.config on the service:</p> <pre><code>&lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.web.extensions&gt; &lt;scripting&gt; &lt;webServices&gt; &lt;authenticationService enabled="true" requireSSL = "false"/&gt; &lt;/webServices&gt; &lt;/scripting&gt; &lt;/system.web.extensions&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="System.Web.ApplicationServices.AuthenticationService" behaviorConfiguration="AuthenticationServiceTypeBehaviors"&gt; &lt;endpoint contract="System.Web.ApplicationServices.AuthenticationService" binding="basicHttpBinding" bindingConfiguration="userHttps" bindingNamespace="http://asp.net/ApplicationServices/v200"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="userHttps" allowCookies="true"&gt; &lt;!--&lt;security mode="Transport" /&gt;--&gt; &lt;/binding&gt; &lt;/basicHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="AuthenticationServiceTypeBehaviors"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>EDIT: Something else I should add, I did a Fiddler session of the service calling the <code>Login</code> method, and the cookie is being set and sent back to the client. But what am I supposed to do with no CookieContainer?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload