Recommended: How to get the first image address in the code by ASP 'Modify the pattern again'code to detect the code'http://www.knowsky.com/asp.asp'leixing html or ubb'nopic code has no picture function toppic(code,leixing,nopic) set regex = ne
1. How to use Asp to determine the virtual physical path of your website
Answer: Use the Mappath method: < %= Server.MapPath(/)% >
2. How do I know the browser used by the user?
Answer: Use the Request object method:
| The following is the quoted content: <% 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 every day
Answer: Solution
| The following is the quoted content: < % startdate=DateDiff(d,Now,01/01/1990) if strdate< 0 then startdate=startdate*-1 avgvpd=Int((usercnt)/startdate) % > |
Show results
| The following is the quoted content: < %response.write(avgvpd) % > that is it.this page have been viewed since November 10,1998 |
4. How to display random images
| The following is the quoted content: < % dim p,ppic,dpic ppic=12 randomize p=Int((ppic*rnd) 1) dpic=graphix/randompics/&p&.gif % > |
show
< img src=< %=dpic% > >
5. How to return to the previous page
Answer: < a href=< %=request.serverVariables(Http_REFERER)% > >preivous page< /a >
Or use an image such as: <img src=arrowback.gif alt=< %=request.serverVariables(HTTP_REFERER)% > >
6. How to determine the other party’s IP address
Answer: < %=Request.serverVariables(REMOTE_ADDR)% >
7. How to link to a picture
| The following is the quoted content: Answer: < % @Languages=vbscript %> < % response.expires=0 strimagename=graphix/errors/erroriamge.gif response.redirect(strimagename) % > |
8. Force password input dialog box
Answer: Put this sentence at the beginning of the page
| The following is the quoted content: < % response.status=401 not Authorized response.end % > |
9. How to pass variables from one page to another
Answer: Use the HIDDEN type to pass variables
| The following is the quoted content: <form method=post action=mynextpage.asp > < % for each item in request.form % > < input name=< %=item% > type=HIDDEN value=< %=server.HTMLEncode(Request.form(item)) % > > < % next % > < /form > |
10. Why do I use msgbox in the asp program? The program error says there is no permission
Answer: Since asp is run by the server, if a dialog box can be displayed on the server, you have to wait until someone presses OK before your program can continue to be executed. Generally, there will be no one on the server, so Microsoft has to ban this function and randomly tell you (haha) that there is no permission. However, ASP and client scripts can display a dialog box, as follows:
| The following is the quoted content: <%yourVar=test dialog%> <script language='javascript'> alert(<%=yourvar%>) </script> |
Share: Four ways to export Excel data by ASP 1. Use OWC What is OWC? OWC is the abbreviation of office Web Comput, which is Microsoft's office Web component. It provides a flexible and basic mechanism for drawing graphics in the web. In an intranet environment, if you can assume a guest