Response.AddHeader使用实例收集
文件下载,指定默认名
1Response.AddHeader("content-type","application/x-msdownload");
2Response.AddHeader("Content-Disposition","attachment;filename=要下载的文件名.rar");
2Response.AddHeader("Content-Disposition","attachment;filename=要下载的文件名.rar");
刷新页面
1Response.AddHeader “REFRESH”, ”60;URL=newpath/newpage.asp”
2这等同于客户机端<META>元素:
3<META HTTP-EQUIV=”REFRESH”, “60;URL=newpath/newpage.asp”
2这等同于客户机端<META>元素:
3<META HTTP-EQUIV=”REFRESH”, “60;URL=newpath/newpage.asp”
页面转向
1Response.Status = “302 Object Moved”
2Response.Addheader “Location”, “newpath/newpage.asp”
3这等同于使用Response.Redirect方法:
4Response.Redirect “newpath/newpage.asp”
2Response.Addheader “Location”, “newpath/newpage.asp”
3这等同于使用Response.Redirect方法:
4Response.Redirect “newpath/newpage.asp”
强制浏览器显示一个用户名/口令对话
1Response.Status= “401 Unauthorized”
2Response.Addheader “WWW-Authenticate”, “BASIC”
3强制浏览器显示一个用户名/口令对话框,然后使用BASIC验证把它们发送回服务器(将在本书后续部分看到验证方法)。
2Response.Addheader “WWW-Authenticate”, “BASIC”
3强制浏览器显示一个用户名/口令对话框,然后使用BASIC验证把它们发送回服务器(将在本书后续部分看到验证方法)。
如何让网页不缓冲
1Response.Expires = 0
2Response.ExpiresAbsolute = Now() - 1
3Response.Addheader "pragma","no-cache"
4Response.Addheader "cache-control","private"
5Response.CacheControl = "no-cache
2Response.ExpiresAbsolute = Now() - 1
3Response.Addheader "pragma","no-cache"
4Response.Addheader "cache-control","private"
5Response.CacheControl = "no-cache