Some ASP tips and practical solutions _ Application Skills

Source: Internet
Author: User
Some ASP techniques and practical solutions

Random number:

<%randomize%>
<%= (int (rnd () *n) +1)%>

The record keywords that are obtained when querying data are displayed in red:

<% =replace (RS ("field x"), Searchname, "<font color= #FF0000 >" & searchname & "</font>")%>

Using ASP to check whether the visitor used the agent

<% if Request.ServerVariables ("Http_x_forwarded_for") <> "" Then
Response.Write "<font color= #FF0000 > You have passed the proxy server," & _
"True IP is" &request.servervariables ("Http_x_forwarded_for")
End If
%>

Determine the origin of the previous page

Request.ServerVariables ("Http_referer")
Javascript:document.referrer

Clear Cache, Reload page

<%response.expires = 0
Response.ExpiresAbsolute = Now ()-1
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-control", "private"
Response.CacheControl = "No-cache"
%>

Display the year and month in the Drop-down menu

<select name= "Select" >
<%
Dim M_year
Dim M_month
Dim M_MONTHJ
Dim M_themonth
Dim M_ym
For m_year = the 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 < 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>

Retrieving and deleting duplicate records in a database

Conn.execute ("Delete from table where ID isn't in" (select distinct from table))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.