您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->SpaceBuilder v1.1源代码>>BlogControls/HttpHandler/ShortLink.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.1源代码
当前文件:文件类型 SpaceBuider11/BlogControls/HttpHandler/ShortLink.cs打开代码结构图
高亮显示
		            //------------------------------------------------------------------------------
// <copyright company="Tunynet">
//     Copyright (c) Tunynet Inc.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------


using System;
using System.Collections.Generic;
using System.Text;
using SpaceBuilder.Blogs.Components;
using SpaceBuilder.Components;

namespace SpaceBuilder.Blogs.Controls
{
    /// <summary>
    /// 处理通过短链接方式访问博客文章
    /// </summary>
    /// <example>
    /// 博客文章一般通过: http://www.spacebuilder.cn/u/WOAI2006/Blog/archive/2008/04/02/959.aspx,
    /// 通过<c>ShortLink</c>可以实现http://www.spacebuilder.cn/u/WOAI2006/Blog/ShortLink.ashx?PostID=959方式访问
    /// </example>
    public class ShortLink : System.Web.IHttpHandler
    {

        #region IHttpHandler Members

        /// <summary>
        /// 对短链接重定向到正在链接
        /// </summary>        
        public void ProcessRequest(System.Web.HttpContext context)
        {
            if (context.Request.QueryString["PostID"] != null)
            {
                int postID = Int32.Parse(context.Request.QueryString["PostID"]);
                BlogThread blogThread = BlogPosts.GetThread(postID, false);
                if (blogThread != null)
                    context.Response.Redirect(BlogUrls.Instance().ShowPost(blogThread, blogThread.Weblog), true);
            }

            context.Response.Redirect(ChannelUrls.Instance().BlogHome(), true);
        }

        /// <exclude/>
        public bool IsReusable
        {
            get { return false; }
        }

        #endregion
    }
}

        
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:SpaceBuilder v1.1源代码