当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP编程中15个非常有用的例子(一)

ASP
asp #include命令
推荐下天枫常用ASP函数封装,推荐大家使用
asp最简单最实用的计数器
用asp实现的iframe批量替换工具
ASPWebPack 代码 提供下载
asp分页生成html的程序脚本代码
比较不错的asp单表单字段多条件查询
asp下用replace非正则实现代码运行功能的代码
UpdatePanel触发javascript脚本的方法附代码
生成EAN13标准的条形码的ASP代码实例
asp空间奸商查询系统
ASPWebPack(整站文件备份系统) v1.0.2 黑客也用
ASP+FSO可视化目录编历(可增、删、改)下载
提高ASP效率的五大技巧
ASP生成随机字符串(数字+大小写字母)的代码
ASP下存储过程编写入门全接触
利用 cache 做对比静态页的网页技术
ASP生成静态文件编码为UTF-8格式的HTML文件
ASP下的两个防止SQL注入式攻击的Function
asp下的风讯用的SQL通用防注入模块提供了

ASP编程中15个非常有用的例子(一)


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

  ASP编程中15个非常有用的例子

enet学院


 1.如何用Asp判断你的网站的虚拟物理路径

 答 使用Mappath方法

 <p align="center"><font size="4" face="Arial"><b>

 The Physical path to this virtual website is:

 </b></font>

 <font color="#FF0000" size="6" face="Arial">

 <%= Server.MapPath("\")%>

 </font></p>

 2.我如何知道使用者所用的浏览器?

 答 使用the Request object方法

 strBrowser=Request.ServerVariables("HTTP_USER_AGENT")

 If Instr(strBrowser,"MSIE") <> 0 Then

 Response.redirect("ForMSIEOnly.htm")

 Else

 Response.redirect("ForAll.htm")

 End If

 3。如何计算每天的平均反复访问人数

 答 解决方法

 <% startdate=DateDiff("d",Now,"01/01/1990")

 if strdate<0 then startdate=startdate*-1

 avgvpd=Int((usercnt)/startdate) %>

 显示结果

 <% response.write(avgvpd) %>

 that is it.this page have been viewed since November 10,1998

 4 如何显示随机图象

 〈% dim p,ppic,dpic

 ppic=12

 randomize

 p=Int((ppic*rnd)+1)

 dpic="graphix/randompics/"&p&".gif"

 %>

 显示

 〈img src="<%=dpic%>>">

 5.如何回到先前的页面

 答<a href="<%=request.serverVariables("Http_REFERER")%>">preivous page</a>

 或用图片如:<img src="/upload/tech/20091103/20091103101120_2a9d121cd9c3a1832bb6d2cc6bd7a8a7.gif"" alt="<%=request.serverVariables("HTTP_REFERER")%>">

 6.如何确定对方的IP地址

 答〈%=Request.serverVariables("REMOTE_ADDR)%>

 7。如何链结到一副图片上

 <% @Languages=vbscript %>

 <% response.expires=0

 strimagename="graphix/errors/erroriamge.gif"

 response.redirect(strimagename)

 %>