Redirection to a certain page after authentication

   —   
When using log on web part, sometimes it is required to redirect the user to some specific page.
This is possible by modifying the code of the LogonForm web part. It is recommended to create a copy of the default web part to avoid changes after upgrading - Modifying the code of standard web parts.

Then you need to modify the code behind to look for example like this:

if (this.DefaultTargetUrl != "")
{
     Response.Redirect(ResolveUrl(this.DefaultTargetUrl));
}
// If the user comes to the ~/SpecialPages/Logon.aspx, it will redirect him/her
//to ~/member/samplepage.aspx after successful authentication

else if (Request.Url.Query.Contains("Logon"))  // Hard-coded
{
      Response.Redirect("~/Member/SamplePage.aspx");   // Hard-coded page to redirect to
}

else
{
      Response.Redirect(URLRewriter.CurrentURL);
}

See also:

Applies to: Kentico CMS 3.x
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.