Some ASP skills and practical solutions

Source: Internet
Author: User

Some ASP skills and practical solutions

Random Number:

<% Randomize %>
<% = (INT (RND () * n) + 1) %>

The record keywords obtained when querying data are displayed in Red:

<% = Replace (RS ("field x"), searchname, "<font color = # ff0000>" & searchname & "</font>") %>

Use ASP to check whether proxy is used by visitors

<% If request. servervariables ("http_x_forwarded_for") <> "then
Response. Write "<font color = # ff0000> you have passed the proxy server ,"&_
"The real IP address is" & request. servervariables ("http_x_forwarded_for ")
End if
%>

Determine the source of the previous page

Request. servervariables ("http_referer ")
Javascript: Document. referrer

Clear cache and reload the page

<% Response. expires = 0
Response. expiresabsolute = now ()-1
Response. addheader "Pragma", "No-Cache"
Response. addheader "cache-control", "private"
Response. cachecontrol = "no-Cache"
%>

Show 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 = 2000 to 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 <10 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>

Retrieve and delete duplicate records in the database

Conn.exe cute ("delete from table where id not 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.