Forum Discussion
Custom visuals not showing with Custom authentication
- 17 days ago
For you many thanks for pointing me the right way. To anyone else stuck in the same hole:
The answer is to add two more parameters onto the definition of the sqlAuthCookie in webconfig.config thus:
<authentication mode="Forms"> <forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="60" path="/" cookieSameSite="None" requireSSL="true"> </forms> </authentication>and to add a line to mark the cookie secure in logon.aspx.cs in AllowInReader thus:
if (passwordVerified) { HttpCookie cookie = FormsAuthentication.GetAuthCookie(sUserName, false); cookie.Secure = true; FormsAuthentication.RedirectFromLoginPage( sUserName, false); } else { this.BtnLogon.Text = "Failed"; Response.Redirect("logon.aspx"); }I hope this saves someone else having to read as much contradictory Microsoft documentation as I had to!
Chris
For you many thanks for pointing me the right way. To anyone else stuck in the same hole:
The answer is to add two more parameters onto the definition of the sqlAuthCookie in webconfig.config thus:
<authentication mode="Forms">
<forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="60" path="/" cookieSameSite="None" requireSSL="true">
</forms>
</authentication>and to add a line to mark the cookie secure in logon.aspx.cs in AllowInReader thus:
if (passwordVerified)
{
HttpCookie cookie = FormsAuthentication.GetAuthCookie(sUserName, false);
cookie.Secure = true;
FormsAuthentication.RedirectFromLoginPage(
sUserName, false);
}
else
{
this.BtnLogon.Text = "Failed";
Response.Redirect("logon.aspx");
}I hope this saves someone else having to read as much contradictory Microsoft documentation as I had to!
Chris