[1] [2] [3]  request 对象 错误 'asp 0206 : 80004005'
不能调用 binaryread
/my/upload.inc,行 51
使用 request.form 集合之后,不能调用 binaryread。
upload.inc代码前的文件,和包含的文件不得含有request.form
/my/upload.inc <% set conn=server.createobject("adodb.connection") conn.open "driver={microsoft access driver (*.mdb)};dbq=" & server.mappath("mydatabase/#visitcount.mdb") phoneaccept=request.servervariables("http_accept") '支持的文件类型 phoneip = request.servervariables("remote_addr") '客户端的ip地址 phonenumber=request.querystring("phonenumber") & request.servervariables("http_x_up_calling_line_id") & request.servervariables("deviceid") visitfile =request.servervariables("http_url") '访问的文件路径 phoneuseragent = request.servervariables("http_user_agent") if phoneip="218.12.56.224" then ' or phoneip="211.94.69.240" ' iswriteindb="false" '如果取到的为自己调试的ip地址,则不写入数据表。屏蔽此句,可以记录所有ip访问。 end if 'if instr(terminal,"m3gate")<>0 then ' ' iswriteindb="false" '开发人员用m3gate调试。 'end if if instr(phoneuseragent,"mozilla")<>0 then ' iswriteindb="false" '非手机和wap模拟器都不写入数据库 end if if phoneip=session("phoneip") then ' iswriteindb="false" '不是每次访问都写入。防止重复写入较多同一地址 end if ' session.timeout=30 '设置session的时间为60分钟。 ' session("phoneip")=phoneip %>
<% 'if iswriteindb<>"false" then strsql="insert into visitcount(phonenumber,phoneip,phoneuseragent,phoneaccept,visitfile) values (" & "'" & phonenumber & "','" & phoneip & "','" & phoneuseragent & "','" & phoneaccept & "','" & visitfile & "')" set rs=conn.execute(strsql) 'end if %>
清除asp缓存三个办法 [ 2010-04-19 | 本站原创 ] 清除asp缓存三个办法 1、在asp页面首部加入 response.buffer = true response.expiresabsolute = now() - 1 response.expires = 0 response.cachecontrol = "no-cache" response.addheader "pragma", "no-cache" 或者将此代码写到一个包含文件包含到asp文件里
2、在html代码中加入 <head> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> </head>
3、在重新调用原页面的时候在给页面传一个参数 href="****.asp?random()"
ASP判断远程文件是否存在 [ 2009-06-27 | 本站原创 ] <% function testurl(url) dim httpxml set httpxml = createobject("msxml2.xmlhttp") httpxml.open "head",url,false httpxml.send if httpxml.status = 200 then testurl = 1 else testurl = 0 end if set httpxml = nothing end function
这里的200表示是200即访问正常如果是404是的话则说明页面不存在呵
下面是实例 if testurl("http://www.goldtimes.net/lspic/price/01-19.rar")=0 then response.redirect "http://www.nmi.cn" else response.redirect "http://www.hnyp.cn" end if
%>
以上是方法一,我写了一个更简单的供大家参考使用
---------------------------------------------------------
set xmlhttp =server.createobject("microsoft.xmlhttp") xmlhttp.open("head","http://www.nmi.cn/index.htm",false) xmlhttp.send() if xmlhttp.status=200 then '文件存在 end if
asp复制文件到其他文件夹下重新命名
<%on error resume next dim fso,wj,path,filepath,foldername,newfilename,targetpath wj="../index.html" path="/wenjian/" set fso=server.createobject("scripting.filesystemobject") filepath=server.mappath(wj)'得到源文件路径 foldername=server.mappath(".")&path'得到新目录a路径 newfilename="other.html"'得到保存到a目录的新文件名 targetpath=foldername&""&newfilename'得到新文件完整路径 if fso.folderexists(foldername) then'判断a目录是否存在 fso.copyfile filepath,targetpath,true else fso.createfolder(foldername)'创建a目录 fso.copyfile filepath,targetpath,true end if set fso=nothing'释放内存 if err then response.write err.description end if %> asp 防盗链 [ 2009-06-07 | 本站原创 ] <!--#include file="include/agang_sql.asp"--> <!--#include file="conn.asp"--> <% server_v1=cstr(request.servervariables("http_referer")) server_v2=cstr(request.servervariables("server_name")) if mid(server_v1,12,len(server_v2))<>server_v2 and mid(server_v1,8,len(server_v2))<>server_v2 then response.write "<script language=javascript>alert('非法操作');history.back(-1)</script>" response.end end if %> <% set rs=server.createobject("adodb.recordset") sql="select download from shop_goods where id="&request("id") rs.open sql,conn,1,1 url=""&rs(0)&"" response.redirect "http://download.nmi.cn:8081/"&url response.end rs.close set rs=nothing conn.close set conn=nothing%>
禁止站外提交的正确写法 [ 2009-06-01 | 本站原创 ] <% server_v1=cstr(request.servervariables("http_referer")) server_v2=cstr(request.servervariables("server_name")) if mid(server_v1,8,len(server_v2))<>server_v2 then response.write "<script language=javascript>alert('error');history.back(-1)</script>" response.end end if %>
这是网络上公布的代码,其实是很不完善的。
忽略了有www和没有www的情形。
正确的写法:
<% server_v1=cstr(request.servervariables("http_referer")) server_v2=cstr(request.servervariables("server_name")) if mid(server_v1,12,len(server_v2))<>server_v2 and mid(server_v1,8,len(server_v2))<>server_v2 then response.write "<script language=javascript>alert('error');history.back(-1)</script>" response.end end if %>
在以下网站中测试通过
http://www.pany.net.cn
http://pany.net.cn
http://hainan.hnyp.cn 让asp生成UTF-8格式 [ 2009-04-20 | 本站原创 ] 这里set myfile = fso.createtextfile(xmlfile,true) 再加上一个参数值"true"就行了,就这样 set myfile = fso.createtextfile(xmlfile,true,true) CInt与Int的区别 [ 2009-04-03 | 本站原创 ]
cint 会进行四舍五入取最接近它的偶数,也就是说当小数部分为0.5xxxx时,它会取最接近x.5xx的偶数. 如 cint(0.5)=0 ; cint(1.5)=2 ; cint(2.5)=2 ;cint(3.5)=4 而int就是取整函数,会去除小数点部分.如 int(1.5)=1 ... ASP CDate 函数 [ 2009-04-03 | 本站原创 ] cdate函数能够将有效的日期或是时间表达式转换成为date类型并返回结果。
tip: use the isdate function to determine if date can be converted to a date or time. 提示:可以使用isdate函数来判断能否转换成为日期或是时间。
note: the isdate function uses local setting to determine if a string can be converted to a date ("january" is not a month in all languages.) 注意:isdate函数使用的是本地化设置来判断字符串是否能够转换成为日期("january"在所有语言中不一定代表为一个月份)
------------------------ d="april 22, 2001" if isdate(d) then document.write(cdate(d)) end if output: 2/22/01 [1] [2] [3]  |