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);
&
相关文档:
< align=middle src=http://player.youku.com/player.php/sid/XMTQ3NTE2NzIw/v.swf width=480 height=400 type=application/x-shockwave-flash allowScriptAccess="sameDomain" quality="high" mce_src="http://player.youku.com/player.php/sid/XMTQ3NTE2NzIw/v.swf"> ......
Asp.net页面之间传递参数的几种方法
第一种方法:ITPUB个人空间R:s`4eP
通过URL链接地址传递Request.QueryStringITPUB个人空间/G3Z;zZs'| `
send.aspx:ITPUB个人空间@ V.X@k7P ^L'B
protected void Button1_Click(object sender, EventArgs e)
Zv!cSZ]6hB ?0 {
......
ASP.NET 安全认证(一)—— 如何运用 Form 表单认证
ASP.NET 安全认证(二)——灵活运用 Form 表单认证中的 deny 与 allow 及保护 .htm 等文件
ASP.NET 安全认证(三) ——用Form 表单认证实现单点登录(Single Sign On)
ASP.NET 安全认证(四)Form 认证的补充 ......
csv 文件跟txt 文件比较相像可以用流直接读取.
excel 这种有结构的文件,流不能直接读取.
StreamReader m_sr=new StreamReader(this.FileLoad.PostedFile.InputStream, System.Text.Encoding.Default);
string s="";
string strTemp="";
while (m_sr.Peek()> ......