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

ASP
asp数个使用技巧
存储过程里的递归 实现方法
非常不错的列出sql服务器上所有数据库的asp代码
防范ASP木马的十大基本原则强列建议看下
雷客图ASP站长安全助手的ASP木马查找功能
防止别人盗链的好方法推荐
图片的入库与读取的方法
用asp实现无组件生成验证码的方法2种
用asp实现检测文件编码
[asp]怎么添加验证码的解决方法
ASP文章系统解决方案实现上一页下一页
ASP编程入门进阶(三):接触脚本程序
ASP编程入门进阶(四):内置对象Request
ASP编程入门进阶(五):内置对象Response
ASP编程入门进阶(六):Cookies讲座
ASP编程入门进阶(八):内置对象Session
ASP编程入门进阶(九):内置对象Application
ASP编码优化技巧8则
ASP编程入门进阶(十):Global.asa文件
ASP编程入门进阶(十一):Chat聊天程序

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


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

 %>