Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Login page displayed when page has passed StopPublish date.

Vote:
 

We have a client who wants to use the StartPublish and StopPublish properties to automatically take down competitions and offers. The problem is that if the page has timed out, or is inaccessible to normal visitors, then a user is redirected to the Login page, which is not what we want.

Is there a way that we can intercept this redirection and redirect the user to a generic Offer Closed page?

 Thanks,

Jim. 

#19814
May 07, 2008 11:52
Vote:
 

Sure, override AccessDenied in the codebehind for the template/ASPX that handles this competition page and make your own implementation.

 

#19820
May 07, 2008 15:39
Vote:
 

Thanks for that pointer Per.

Just in case anyone else has this problem, here's the solution I've come up with. 

I put this little override function together, using some code from Joshua Flanagan's Custom Error HttpModule.

public override void AccessDenied()

{
string redirectPage;

CustomErrorsSection section = WebConfigurationManager.GetWebApplicationSection(@"system.web/customErrors") as CustomErrorsSection;
if (section == null || section.Mode == CustomErrorsMode.Off)
{
base.AccessDenied();
}
else
{
CustomError definedError = section.Errors.Get("404");
redirectPage = (definedError != null) ? definedError.Redirect : section.DefaultRedirect;
Response.Redirect(redirectPage);
}
}

 Jim.

#19831
Edited, May 07, 2008 18:10
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.