Would this be possible with 2sxc?

Jun 8, 2015 at 10:49 PM
An app that redirects users to another page if the page has passed a certain date?

I have a website that uses temporary landing pages for promotions, special offers, etc. With stock DNN, you can set a page to expire, but the user just goes to a 404.

I'd like editors to be able to add an app to a page, enter a date to redirect after, and the page to redirect to.

This seems like something that could be done with Razor, but I'm not sure if 2sxc would be the best option for something like this.

Thoughts, advice?
Coordinator
Jun 9, 2015 at 7:21 AM
sounds very trivial; yes, I would do it w/2sxc

You'll need about 2 lines of razor, because with tokens you can't do if-statements
Jun 9, 2015 at 4:54 PM
Ha... you're right! 2 lines of razor:
@using System.Web
@if (DateTime.Now > Content.ExpireDate) { Response.Redirect(Content.Page); }
I guess I just needed the moral support. Thanks! :)
Jun 9, 2015 at 5:01 PM
And rounded out with a handy admin message...
@using System.Web

@if (HttpContext.Current.User.Identity.IsAuthenticated)
{
    <div style="text-align: center;">
        <h3>Redirect After Date App* &nbsp @Content.Toolbar</h3>
        <p>
            <strong>
                This page will redirect to @Content.Page after @Content.ExpireDate.
            </strong>
        </p>
        <p>*This message only visible to editors. Click edit to set redirect page and date.</p>
    </div>
}

@if (DateTime.Now > Content.ExpireDate)
{
    Response.Redirect(Content.Page);
}
I love 2sxc!
Coordinator
Jun 10, 2015 at 2:09 PM
thanks :)
And please rate it here on codeplex - v7 only has one rating so far and we need a bunch to build trust
Jun 10, 2015 at 3:19 PM
Will do. Are you guys planning on a permanent move to GitHub? There seems to be more room for open discussion here on CodePlex, although GitHub's label system might help to sort the issues from more general discussion.
Coordinator
Jun 10, 2015 at 7:02 PM
ATM we're still planning on having the primary download on codeplex - but it is an cumbersome extra piece of work. The forum too doesn't really exist on github, so we're still a bit hybrid. No real strategy to this for now.