推荐:用ASP编写更人性化的弹出窗口程序ASP实例:用ASP编写更人性化的弹出窗口程序,来帮我们制作一个不烦人的调查的方法。用弹出窗口来显示调查表,被认为是达到我们收集访问用户信息的最方便快捷的方法。当制作出第一份调查表后
我们在制作网站的时候,通常会有当访客的一些错误操作或我们网站本身的缺陷,造成某个不存在的页面被访问,这时会出现404错误提示信息,如果是热心的访客可能会给你发一封邮件提示你,当时大部分时候是访客不会给我们发邮件的。今天给大家介绍的这个程序是当我们的网站出现404错误提示时自动发送一封邮件给我们,代码如下:
以下为引用的内容: <% @language="vbscript" %> <% Option Explicit %> <% Dim strPage, strReferer, strMessage Dim objSMTP ' Log the offending page strPage = Request.ServerVariables("HTTP_URL") ' Log the referer strReferer = Request.ServerVariables("HTTP_REFERER") ' Set up the email component Set objSMTP = Server.CreateObject("JMail.Message") objSMTP.From = "you@yourdomain.com" objSMTP.FromName = "Your Domain" objSMTP.Subject = "404 Error Logged" objSMTP.AddRecipient("you@yourdomain.com") ' Write the message strMessage = "Requested page: " & strPage & vbCrLf & vbCrLf If strReferer <> "" Then strMessage = strMessage & "Referer: " & strReferer Else strMessage = strMessage "The visitor typed the address in" End If objSMTP.Body = strMessage ' Send the message objSMTP.Send("mail.jzxue.com") ' Tidy up objSMTP.ClearRecipients objSMTP.Close() Set objSMTP = Nothing %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>404 Page Not Found</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <h1>404 Page Not Found Error</h1> <p> Appropriate message here. </p> </body> </html> <% @language="vbscript" %> <% Option Explicit %> <% Dim strPage, strReferer, strMessage Dim objSMTP ' Log the offending page strPage = Request.ServerVariables("HTTP_URL") ' Log the referer strReferer = Request.ServerVariables("HTTP_REFERER") ' Set up the email component Set objSMTP = Server.CreateObject("JMail.Message") objSMTP.From = "you@yourdomain.com" objSMTP.FromName = "Your Domain" objSMTP.Subject = "404 Error Logged" objSMTP.AddRecipient("you@yourdomain.com") ' Write the message strMessage = "Requested page: " & strPage & vbCrLf & vbCrLf If strReferer <> "" Then strMessage = strMessage & "Referer: " & strReferer Else strMessage = strMessage "The visitor typed the address in" End If objSMTP.Body = strMessage ' Send the message objSMTP.Send("mail.jzxue.com") ' Tidy up objSMTP.ClearRecipients objSMTP.Close() Set objSMTP = Nothing %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>404 Page Not Found</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <h1>404 Page Not Found Error</h1> <p> Appropriate message here. </p> </body> </html> |
请作者联系本站,及时附注您的姓名。联系邮箱:CuoXIn#vip.qq.com(把#改为@)。
分享:初学者的ASP教程:常用ASP内置函数函数,就是该语言封装了的一个功能块,以方便用户的调用。比如“now()”在VBScript中就是一个能显示出当前日期和时间的函数。至于具体为什么能显示,则是该语言内核所定的,用户只需
新闻热点
疑难解答