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

Response.AddHeader的更多相关文章

  1. Response.AddHeader使用实例

    1.文件下载,指定默认名Response.AddHeader("content-type","application/x-msdownload"); // 限制 ...

  2. [转]Response.AddHeader 文本下载

    本文转自:http://hi.baidu.com/yuxi981/item/7c617fc41b03ad60f6c95d30 Response.AddHeader实现下载     /// <su ...

  3. Response.AddHeader小结

    (一)文件下载,指定默认名 Response.AddHeader("content-type","application/x-msdownload"); Res ...

  4. C#中解决Response.AddHeader("Content-Disposition", "attachment; filename=" + filename)下载文件时文件名乱码的问题

    问题:下载文件时文件名乱码怎么解决? 在C#写后台代码过程中,经常遇到下载文件出现文件名乱码的问题,在网上找了很多方法,总是存在浏览器不兼容的问题,当IE浏览器不乱码时,火狐浏览器就会乱码,后来经过反 ...

  5. 关于使用response.addHeader下载中文名乱码问题

    介绍下我项目中遇到的问题:在数据库导出Excel文件的过程中,导出文件中文名始终异常,最终结果发现需要在response.addHeader 中的 filename = "xxxx" ...

  6. 解决Response.AddHeader中文乱码问题

    string filename = HttpUtility.UrlEncode(Encoding.UTF8.GetBytes("培训班自然情况表")); Response.AddH ...

  7. 【转】解决response.AddHeader("Content-Disposition", "attachment; fileName=" + fileName) 中文显示乱码

    如果fileName为中文则乱码.解决办法是 方法1: response.setHeader("Content-Disposition", "attachment; fi ...

  8. 解决Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name) 中文显示乱码

    如果file.Name为中文则乱码.解决办法是方法1:response.setHeader("Content-Disposition", "attachment; fil ...

  9. Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name) 中文显示乱码

    如果file.Name为中文则乱码.解决办法是方法1:response.setHeader("Content-Disposition", "attachment; fil ...

随机推荐

  1. AtCoder Beginner Contest 055题解

    A.当a=1就把a改成14,b=1就把b改成14,然后比较a,b大小即可. #include <iostream> #include <algorithm> #include ...

  2. C语言枚举类型(Enum)深入理解

    在实际编程中,有些数据的取值往往是有限的,只能是非常少量的整数,并且最好为每个值都取一个名字,以方便在后续代码中使用,比如一个星期只有七天,一年只有十二个月,一个班每周有六门课程等. 以每周七天为例, ...

  3. day001-html知识点总结(-)块级。行内元素区分

    -.行内元素和块级元素的区别与转换: 区别: 1.从形式上看,在标准文档流中,行内元素会水平方向呈线性排列,而块级元素会各占一行,垂着方向排列. 2.在结构使用上,块级元素可以包含行内元素和块级元素, ...

  4. 1094:零起点学算法01——第一个程序Hello World!

    Description 题目很简单 输出"Hello World!"(不含引号),并换行. Input 没有输入 Output 输出"Hello World!" ...

  5. ios animation 动画效果实现

    1.过渡动画 CATransition CATransition *animation = [CATransition animation]; [animation setDuration:1.0]; ...

  6. MySQL的loop循环函数的demo

    使用的工具是Navicat for MySQL. 在MySQL中用函数实现在字符串一后面循环拼接n个字符串二 delimiter $$ drop function if exists fun_addS ...

  7. ValueStack

    1.把list集合压入栈顶 /** * * 查找所有的用户 * @return */ public String findAll() { List<User> allUser = user ...

  8. Java中的排序方法

    冒泡排序法 快速排序

  9. 【Shell】使用Shell脚本发布项目

    第一次写Shell脚本,没经验,是直接写呢,还是要走流程( ̄▽ ̄)~* ---------------------------------------------------------------- ...

  10. HDU 5556 最大独立集

    这题主要有了中间的一些连通块的限制,不太好直接用二分图最大独立集做.考虑到图比较小,可以作补图求最大团来求解. #include <iostream> #include <vecto ...