linkredirector.cs

来自「一个ASP.NET下的中文内容管理和社区系统」· CS 代码 · 共 37 行

CS
37
字号
namespace ASPNET.StarterKit.Communities.Links {

    using System;
    using System.Web.UI.WebControls;

    //*********************************************************************
    //
    // LinkRedirector Class
    //
    // This class redirects the user to the URL represented by a link
    // and records the redirection through the GetLinkUrl call.
    //
    //*********************************************************************

    public class LinkRedirector : WebControl {



        //*********************************************************************
        //
        // OnLoad Method
        //
        // Calls the GetLinkUrl method to get the Link URL from the LINK ID
        // and redirects the user to the target of the link.
        //
        //*********************************************************************

        protected override void OnLoad(EventArgs e) {
            int contentPageID = Int32.Parse(Context.Request.QueryString["id"]);
            string linkUrl = LinksUtility.GetLinkUrl(contentPageID);
            Context.Response.Redirect(linkUrl);
        }


    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?