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

ASP
asp 实现对SQL注入危险字符进行重编码处理的函数
asp下实现对HTML代码进行转换的函数
asp 验证用户名是否包含有非常字符的函数
ASP通用分页样式函数代码
asp 生成任意英文+数字位数长度的随机码函数
asp 取得中文句子头一个字的大写拼音字母的函数
asp实现计算两个时间内的工作日的函数
asp实现过滤关键字的函数
asp实现限制搜索的关键字的函数
asp动态include文件,方便多模板的实现
推荐的用Asp实现屏蔽IP地址访问的代码
XDOWNPAGE ASP版本 分页类
飞云防CC攻击ASP程序代码插件
定期自动运行ASP程式的代码
ASP下Cookie操作的详细讲解
再发几个ASP不错的函数
比较不错的asp模板引终极讲解(WEB开发之ASP模式)
ip138之asp小偷程序代码
在VBScript中实现-函数/方法名作为参数传入另一个函数
asp实现批量插入表单中的数据到数据库的方法

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 34 ::
收藏到网摘: 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)")