I've created a custom pipeline to process the login to sent 2FA token. But somehow the pipeline is triggered twice. It doesn't happen with LoggingInProcessor (Used before Sitecore 9). Anyone know why? Currently, I'm using Sc 9.1 with IdentityServer.
Here's a quick description of the code
Config patch:
<sitecore role:require="Standalone or ContentManagement">
<pipelines>
<owin.cookieAuthentication.signIn>
<processor resolve="true" type="Mydll.MySignInPipeline, Mydll"
patch:after="processor[@type='Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.SignIn.UpdateUserProperties, Sitecore.Owin.Authentication']"/>
</owin.cookieAuthentication.signIn>
<owin.cookieAuthentication.signedIn>
<processor resolve="true" type=" Mydll.Mypipeline, Mydll"
patch:before="processor[@type='Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.SignedIn.CreateTicket, Sitecore.Owin.Authentication']"/>
<processor resolve="true" type="Mydll.Mypipeline, Mydll"
patch:before="processor[@type='Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.SignedIn.CreateTicket, Sitecore.Owin.Authentication']"/>
<processor resolve="true" type="Mydll.Mypipeline, Mydll"
patch:before="processor[@type='Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.SignedIn.CreateTicket, Sitecore.Owin.Authentication']"/>
</owin.cookieAuthentication.signedIn>
</pipelines>
</sitecore>
MySignInPipeline is triggered twice, right after I click the Login, then right after It redirect to a new page (any pages) but before page load (Before on load)
I've tried reorder pipeline position but no luck.
Update
I was using WebUtil.Redirect(). But when I change it to Http.Response.Redirect("/redirectpath/",false) it's fixed. Found out that WebUtil.Redirect() always set it true :
public static void Redirect(string path, bool allowSame)
{
Assert.ArgumentNotNull(path, "path");
HttpContext current = HttpContext.Current;
if (current != null && (allowSame || !WebUtil.IsOnPage(path)))
{
current.Response.Redirect(path, true);
}
}
. But idk why, maybe anyone here can explain?
Role
?