aggbughandler.cs
来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 61 行
CS
61 行
//------------------------------------------------------------------------------
// <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 + =
减小字号Ctrl + -
显示快捷键?