Copied to clipboard

Flag this post as spam?

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


  • sun 403 posts 395 karma points
    Aug 23, 2011 @ 10:31
    sun
    0

    How can I redirect a node to a externalUrl?

    I created a document type with a field named externalUrl, it's string type, then how can I get externalUrl value in template? 

    <%@ Master Language="C#" MasterPageFile="~/masterpages/umbMaster.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="cp_content" runat="server">

    <%if (strip(node.externalUrl.Length>0) {

    Response.Redirect(node.externalUrl);

    }

    %>

     

     

    </asp:Content>

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 23, 2011 @ 13:07
    Dirk De Grave
    0

    wow, if i'd run this code, there would be multiple asp.net errors... where's your strip function and what is *node*.

    If you need to reference the current node from your template, use umbraco.businesslogic.nodeFactory.Node.GetCurrent() and if you need the value for a property, use .GetProperty("alias").Value

     

    /Dirk

  • sun 403 posts 395 karma points
    Aug 23, 2011 @ 13:59
    sun
    0

    Thank you very much.

Please Sign in or register to post replies

Write your reply to:

Draft