Note that there are some explanatory texts on larger screens.

plurals
  1. POFormsAuthentication.Decrypt always returns null
    text
    copied!<p>I'm trying to create a FormsAuthenticationTicket object by decrypting the authentication cookie string using the following approach:</p> <pre><code>Cookie securityContextCookie = cookies["myCookie"]; FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(securityContextCookie.Value); // ticket returns null even with a valid encrypted cookie string </code></pre> <p>Config:</p> <pre><code>&lt;roleManager enabled="true" defaultProvider="WebRoleProvider"&gt; &lt;providers&gt; &lt;clear /&gt; &lt;add name="WebRoleProvider" type="Framework.Security.Providers.WebRoleProvider" connectionStringName="aspnetdb" applicationName="TestApp" /&gt; &lt;/providers&gt; &lt;/roleManager&gt; &lt;membership defaultProvider="WebMembershipProvider" userIsOnlineTimeWindow="15"&gt; &lt;providers&gt; &lt;clear /&gt; &lt;add name="WebMembershipProvider" type="Framework.Security.Providers.WebMembershipProvider" connectionStringName="aspnetdb" applicationName="TestApp" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Clear" /&gt; &lt;/providers&gt; &lt;/membership&gt; &lt;machineKey decryption="3DES" decryptionKey="..." validation="3DES" validationKey="..." /&gt; &lt;authentication mode="Forms"&gt; &lt;forms defaultUrl="dashboard" loginUrl="login" timeout="20" /&gt; &lt;/authentication&gt; </code></pre> <p> </p> <p>Login Form:</p> <pre><code>&lt;asp:Login ID="Login1" runat="server" MembershipProvider="WebMembershipProvider" Font-Size="13px" TextLayout="TextOnTop" LoginButtonType="Image" LoginButtonText="" LoginButtonImageUrl="~/Content/Images/login-button.png" LabelStyle-HorizontalAlign="Left" LoginButtonStyle-CssClass="" ToolTip="Log In" RememberMeText="Remember me?" FailureAction="Refresh" TitleText=""&gt; &lt;TextBoxStyle Font-Size="13px" BorderStyle="Solid" BorderWidth="1px" Width="385px" Height="20px" BorderColor="#e1e4ea" CssClass="login-form-textboxes" /&gt; &lt;LoginButtonStyle Font-Names="Verdana" /&gt; &lt;InstructionTextStyle Font-Italic="False" ForeColor="#464749" Font-Size="12px" /&gt; &lt;LabelStyle Font-Size="11px" ForeColor="#939598" Font-Bold="true" CssClass="login-form-labels" /&gt; &lt;TitleTextStyle Font-Bold="True" Font-Size="14px" ForeColor="#464749" /&gt; &lt;CheckBoxStyle CssClass="login-form-checkboxes" /&gt; &lt;/asp:Login&gt; </code></pre> <p>Even though the value of securityContextCookie looks like a valid encrypted cookie string I keep getting null back for ticket...</p> <p>Any idea what might cause the issue?</p> <p>Thanks for you help</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