1. How to use ASP to determine the virtual physical path of your website
Answer: Using the MapPath method
< 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. How do I know the browser used by the user?
Answer: Use the Request object method
strBrowser=Request.ServerVariables("HTTP_USER_AGENT")
If Instr(strBrowser,"MSIE") < > 0 Then
Response.redirect("ForMSIEOnly.htm")
Else
Response.redirect("ForAll.htm")
End If
3. How to calculate the average number of repeated visits per day
Answer: the solution
< % startdate=DateDiff("d",Now,"01/01/1990")
if strdate< 0 then startdate=startdate*-1
avgvpd=Int((usercnt)/startdate) % >
Show results
< % response.write(avgvpd) % >
that is it.this page have been viewed since November 10,1998
4. How to display random images
< % dim p,ppic,dpic
ppic=12
randomize
p=Int((ppic*rnd)+1)
dpic="graphix/randompics/"&p&".gif"
% >
显示
< img src="< %=dpic% >" >
5. How to get back to the previous page
For:
< a href="< %=request.serverVariables("Http_REFERER")% >" >preivous page< /a > 或用图片如:< img src="arrowback.gif" alt="< %=request.serverVariables("HTTP_REFERER")% >" >