ASP技巧:Response.AddHeader使用实例收集
来源:岁月联盟
时间:2009-05-08
程序代码
Response.AddHeader("content-type","application/x-msdownload");
Response.AddHeader("Content-Disposition","attachment;filename=要下载的文件名.rar");
刷新页面
程序代码
Response.AddHeader "REFRESH", "60;URL=newpath/newpage.asp"
等同于客户机端<META>元素:
程序代码
<META HTTP-EQUIV="REFRESH","60;URL=newpath/newpage.asp">
页面转向
程序代码
Response.Status = "302 Object Moved"
Response.Addheader "Location", "newpath/newpage.asp"
等同于使用Response.Redirect方法:
程序代码
Response.Redirect "newpath/newpage.asp"
强制浏览器显示一个用户名/口令对话框
程序代码
Response.Status= "401 Unauthorized"
Response.Addheader "WWW-Authenticate", "BASIC"
如何让网页不缓冲
程序代码
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.Addheader "pragma","no-cache"
Response.Addheader "cache-control","private"
Response.CacheControl = "no-cache"
上一篇:ASP缓存类