Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Alx 1 post 21 karma points
    Aug 12, 2014 @ 20:16

    redirect virtual page to external url


    I have been set a challenge.  I need to make "" redirect to "" preferably transparently.

    I have to add a page to the umbraco site that is outside umbraco and will only exist for a short period, but it needs to be on the same domain and look like part of the site.  It will be stored on the same server, in the same site but outside umbraco.

    what is the best way to achieve this? after a while of searching documenation and forums I have seen 

    Umbraco Version: umbraco v 4.7.2 (Assembly version: 1.0.4500.21031)
    IIS Version: 8.5 Version: 4.0.30319

    Thanks in advance.

  • Dan Lister 416 posts 1973 karma points c-trib
    Aug 14, 2014 @ 15:06
    Dan Lister

    Hi Alx,

    You could create a new document type called 'Redirect Page' and add a property to it called 'Redirect Url'. Within the new template for the document type, you could perform a redirect to the 'Redirect Url' property value. Something like the following, with a 'Redirect Url' property value of the local page you want to redirect to.

    @inherits UmbracoTemplatePage
        Layout = null;
        var redirectUrl = Model.Content.GetPropertyValue<string>("redirectUrl");
        if (!string.IsNullOrWhiteSpace(redirectUrl))
            Response.StatusCode = 301;
            Response.StatusDescription = "Moved Permanently";
            Response.RedirectLocation = redirectUrl;

    Thanks, Dan.

  • Dan Diplo 1553 posts 6170 karma points MVP 4x c-trib
    Dec 03, 2014 @ 21:16
    Dan Diplo

    Since .NET 4.0 you can just shorten all that code to:


    See ;

  • itaRubin 12 posts 112 karma points
    Jan 28, 2021 @ 10:48

    hi Dan, Response.RedirectPermanent() statusCode is 301.

    if I need Redirect with statusCode = 302?

  • Dan Diplo 1553 posts 6170 karma points MVP 4x c-trib
    Jan 28, 2021 @ 10:52
    Dan Diplo

    You can just use Response.Redirect() which is a 302.



Please Sign in or register to post replies

Write your reply to: