当前位置: 首页 > 图文教程 > 网络编程 > ASP > 一些Asp技巧和实用解决方法

ASP
ASP+XML实例演练编程代码
asp下利用XMLHTTP 从其他页面获取数据的代码
asp下实现IP限制函数代码
asp下IP地址分段计算函数
asp身份证验证代码函数
用Asp隐藏文件路径,实现防盗链 的代码
ASP生成柱型体,折线图,饼图源代码提供了
用asp实现网址和邮件地址的转换函数
asp下最简洁的多重查询的解决方案
asp下用datediff实现计算两个时间差的函数
asp下实现记录集内随机取记录的代码
asp下轻松实现将上传图片到数据库的代码
[原创]站长感慨asp编程究竟何去何从
fso asp生成静态html的代码
ASP版实现cookies注入加速工具
ASP实现网页打开任何类型文件都提示保存的方法附代码
asp下使用数组存放数据的代码
一句话 asp木马加密版 彻底突破杀毒软件
asp清空application的方法
使用asp下的adodb.stream 下载文件而不是打开

ASP 中的 一些Asp技巧和实用解决方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 31 ::
收藏到网摘: n/a

一些Asp技巧和实用解决方法
随机数:
<%randomize%>
<%=(int(rnd()*n)+1)%>
查询数据时得到的记录关键字用红色显示:
<% =replace(RS("字段X"),searchname,"<font color=#FF0000>" & searchname & "</font>") %>
通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
判断上一页的来源
request.servervariables("HTTP_REFERER")
javascript: document.referrer
清除缓存,重新加载页面
<%response.expires = 0
response.expiresabsolute = now() - 1
response.addHeader "pragma","no-cache"
response.addHeader "cache-control","private"
Response.cachecontrol = "no-cache"
%>
在下拉菜单中显示年和月
<select name="select">
<%
Dim M_Year
Dim M_Month
Dim M_MonthJ
Dim M_TheMonth
Dim M_YM
For M_Year = 2000 To Year(Date)
M_Month = 12
If M_Year = Year(Date) Then
M_Month = Month(Date)
End If
For M_MonthJ=1 To M_Month
If M_MonthJ < 10 Then
M_TheMonth = "0" & M_MonthJ
Else
M_TheMonth = M_MonthJ
End If
M_YM = M_Year& "-" & M_TheMonth %>
<option value="<%= M_YM %>"><%= M_YM %></option>
<%
Next
Next %>
</select>
检索并删除数据库里的重复记录
conn.execute("delete from table where id not in (select distinct from table)")