⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aggbughandler.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web;

namespace CommunityServer.Components.HttpHandler
{
	/// <summary>
	/// Many aggregators display images.  AggBugHandler enables us to track when a post is read from a syndication file by appened the postid
	/// to the image. We then return an invisible 1x1 image to the client.
	/// </summary>
	public class AggBugHandler : IHttpHandler
	{
		public AggBugHandler()
		{
		}

        private static byte[] _bytes = Convert.FromBase64String("R0lGODlhAQABAIAAANvf7wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
        #region IHttpHandler Members

        /// <summary>
        /// Adds the to the AggCount and renders the image. This value (image) should be cached locally for 12 hours
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
           int postID = CSContext.Current.PostID;
            if(postID > 0)
            {
                Views.AddAggCount(postID);
            }

            context.Response.ContentType = "image/gif";
            context.Response.AppendHeader("Content-Length",_bytes.Length.ToString());
            context.Response.Cache.SetLastModified(DateTime.Now);
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.Cache.SetExpires(DateTime.Now.AddHours(12));
            context.Response.BinaryWrite(_bytes);
            context.Response.StatusCode = 200;
            context.Response.End();


        }

        public bool IsReusable
        {
            get
            {
                // TODO:  Add AggBugHandler.IsReusable getter implementation
                return false;
            }
        }

        #endregion
    }
}

⌨️ 快捷键说明

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