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

📄 avatarhttphandler.cs

📁 解压即可使用
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web;
using System.Web.Caching;
using CommunityServer;

namespace CommunityServer.Components.HttpHandler {

    public class AvatarHttpHandler : IHttpHandler {

        public void ProcessRequest (HttpContext context) {

            try {
                Avatar userAvatar = Resources.GetAvatar( int.Parse(context.Request.QueryString["UserID"]) );

                context.Response.ContentType = userAvatar.ContentType;
                context.Response.OutputStream.Write(userAvatar.Content, 0, userAvatar.Length);

                context.Response.Cache.SetCacheability(HttpCacheability.Public);
                // Terry Denham 7/16/2004
				// changing default cache for avatars from 1 day to 30 minutes
				context.Response.Cache.SetExpires(DateTime.Now.AddMinutes(30));
                context.Response.Cache.SetAllowResponseInBrowserHistory(true);
                context.Response.Cache.SetValidUntilExpires(true);
                context.Response.Cache.VaryByParams["UserID"] = true;
            } catch {}

        }

        public bool IsReusable {
            get {
                return false;
            }
        }
    }
}

⌨️ 快捷键说明

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