asp.net mvc浏览器缓存和压缩的实现
cache在开发高可扩展性的web应用中起着至关重要的作用,我们可以按照预定的时间将任何get请求缓存到浏览器中,如果在预定的时间内用户请求同一URL那么response就会通过浏览器的cache来实现而非server。可以通过下面的action filter在ASP.NET MVC应用中实现同样的功能:
using System;
using System.Web;
using System.Web.Mvc;
public class CacheFilterAttribute: ActionFilterAttribute
{
/// <summary>
/// Get or sets the cache duration in seconds . the default is 10 seconds
/// </summary>
/// <value> the cache duration in seconds </value>
public int Duration
{
get;
set;
}
public CacheFilterAttribute()
{
Duration = 10;
}
public override void OnActionExecuted(FiterExecutedContext filterContext)
{
if (Duration <= 0) return;
HttpCachePolicy cache = fiterContext.HttpContext.Response.Cache;
TimeSpan cacheDuration = TimeSpan.fromSeconds(Duration);
&
相关文档:
ASP.NET 运行机制总结
这些天看了一些关于ASP.NET底层的文章,受益匪浅。
为什么要了解这些底层呢?我觉得做为一个喜欢开发ASP.NET程序员,我不们不仅要知道“怎么做”,我们更应该知道“为什么这么做”,这样的我们才能做得更好。这 ......
http://rzchina.net/node/3210
Web.config文件中可配置的身份验证方式有Windows、Forms、PassPort、None。
Web.config文件中<authentication>节点,身份验证方式取决于该节点“mode”属性的设置。
1.None
None表示不执行身份验证。
2.Windows
IIS根据应用程序的设置执行身份验证,其中包含匿名身份 ......
ASP.NET 安全认证(一)—— 如何运用 Form 表单认证
ASP.NET 安全认证(二)——灵活运用 Form 表单认证中的 deny 与 allow 及保护 .htm 等文件
ASP.NET 安全认证(三) ——用Form 表单认证实现单点登录(Single Sign On)
ASP.NET 安全认证(四)Form 认证的补充 ......
using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace UserControl.UI
{
/// <summary>
/// TreesTable 的摘要说明。
/// </summary>
public class TreesTable
{
public interface iTrees ......
用asp.net操作excel的实现代码,一直都是本人所喜欢的,从网上搜了下ASP.NET Excel找到了这篇好文章
详细出处参考:http://www.jb51.net/article/13629.htm
Excel是Microsoft公司的Office套件中的一种软件,他主要用来处理电子表格。Excel以界面友好、处理数据迅速等优点获得广大办公人员的欢迎。所以很多文档就以Excel的 ......