Hi Jacques,
Really this should not be needed there because Default.aspx.cs is only for CMS pages in the menu and there really should not be extra query string params expected there. We have friendly urls like home.aspx that map to real urls like /Default.aspx?pageid=x, we should not then use home.aspx?someparam=foo
Custom modules should not be passing extra query string params to cms page urls, they can pass extra params to supporting pages of the feature like you see in the forums pages for example but a cms page may have any number of modules on it so any specific module should not pass params in the query string. What if 2 modules do that and use the same param names?
You should link to custom supporting page(s) instead of adding query string params to cms page urls, then in your custom page you can redirect with
if (!Request.IsAuthenticated)
{
SiteUtils.RedirectToLoginPage(this);
return;
}
and this will have the query string params.
I will accommodate you with this change so you can make it work with a config setting that changes the current behavior, but I do not want to encourage the use of query string params in cms page urls so the default will be false.
private bool RedirectIfNeeded()
{
if (
(!isAdmin)
&& (!isSiteEditor)
&& (!WebUser.IsInRoles(CurrentPage.AuthorizedRoles))
)
{
if (!Request.IsAuthenticated)
{
if (WebConfigSettings.UseRawUrlForCmsPageLoginRedirects)
{
SiteUtils.RedirectToLoginPage(this);
}
else
{
SiteUtils.RedirectToLoginPage(this, SiteUtils.GetCurrentPageUrl());
}
return true;
}
else
{
SiteUtils.RedirectToAccessDeniedPage(this);
return true;
}
}
return false;
}
Best,
Joe
ps this should have been a new thread instead of a reply on this thread, your question is about login redirect not registration redirect that the thread originally was about.