asp 中数据导出为 word ,excl ,text ,等格式文件
这是从方法直接复制的,
参数 fileType是文件格式
参数filedName是写出后文件的文件名。
参数suffix是写出后文件的文件后缀名。
Response.Clear(); //清空 缓冲区的所有输出数据
Response.Charset = "utf-8";//设置输出输出流字符类型
Response.ContentType = fileType;设置输出流的 file MIME类型
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName) + suffix);//将HTTP 头添加到输出流,“+”以前是固定的 字符串连接是为了写文件名和文件后缀名
Response.Write("<html><head><Meta http-equiv=\"Content-Type\"content=\"text/html;charset=utf-8\"></head><body>");
Response.Write("<h1>"+article.Title+"</h1><p/>"+article.Context);
Response.Write("</body></html>");
//文件内容
Response.End();
//关闭
当导出的文件为 文本格式时 Response.Write(" ")中就不必写入HTML代码,如果写入了,文本内容会出现 HTML
Response.ContentType ="application/ms-excel";是excel
Response.ContentType ="Content-Disposition";是word
相关文档:
只需要在fckeditor\editor\filemanager\connectors\asp文件夹下的commands.asp修改一下即可
在这个文件中查找一下:FileUpload
会找到这个函数
把
代码如下:
Dim sFilePath
sFilePath = CombineLocalPaths(sServerDir, sFileName)
改为
代码如下:
Dim sFilePath,ranNum
Randomize
ranNum=int(90000*rnd)+ ......
将以下代码放到一个单独的页面checkcode.asp
<%
Option Explicit
Response.buffer=true
Call Com_CreatValidCode("validateCode")
Sub Com_CreatValidCode(pSN)
' 禁止缓存
Response.Expires = -9999
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
Response.ContentTy ......
用ASP实现支持附件的EMail系统(2)
不过这仅仅只是得到了发送者的ip地址和mac地址,而且禁止用户自己更改自己ip地址的代码,因为我们的系统是需要对个人修改ip的行为进行禁止的。
<%
strIP = Request.ServerVariables("REMOTE_ADDR")
Set net = Server.CreateObject("wscript.network")
Set sh = S ......
目前在Internet上广泛使用的后台技术种类繁多,应用比较广泛的有CGI,ASP,PHP,JSP/JavaServlet,ColdFusion等。在这一节里,主要介绍几种在国内应用比较广泛的后台语言。
CGI,全称为Common Gateway Interface
CGI就是公共网关接口 (Common Gateway Interface) 的缩写。它是最早被用来建立动态网站的后台技术 ......