示例#1
0
文件: Security.cs 项目: PavelPZ/REW
 static void checkCookie(HttpContext ctx, LMCookie cook) {
   if (!string.IsNullOrEmpty(cook.EMail)) { // && Machines.isCrawlerEx(ctx)) {
     Emailer em = new Emailer(null, "*****@*****.**", "Invalid crawler: ", ctx.Request.UserAgent);
     //em.From = "*****@*****.**";
     em.AddTo("*****@*****.**");
     em.AddTo("*****@*****.**");
     //em.Subject = "Invalid crawler: " + ctx.Request.UserAgent;
     em.SendMail();
   }
 }
示例#2
0
文件: Logging.cs 项目: PavelPZ/REW
 public override void ProcessEvent(WebBaseEvent eventRaised) {
   if (Machines.isBuildEACache_BuildCD_Crawler) return;
   //Filter neskodnych URL chyb
   string requestUrl = null;
   if (eventRaised is WebRequestErrorEvent) {
     WebRequestInformation inf = ((WebRequestErrorEvent)eventRaised).RequestInformation;
     requestUrl = inf.RequestUrl.ToLower();
     if (Filter.isMatch(HttpContext.Current, "urls", requestUrl)) return;
     //foreach (string s in new string[] { "/dbimg.aspx?lang", "_vti_", "msoffice/cltreq.asp", "/news/images/bg01.gif", "_vpi.xml", "wp-rss"})
     //if (inf.RequestUrl.ToLower().IndexOf(s) >= 0) return;
   }
   string err = null;
   if (HttpContext.Current != null) {
     HttpContext ctx = HttpContext.Current;
     err = "** LM Information **\n--------------\n";
     err += "Agent: " + ctx.Request.Headers["User-Agent"] + "\n";
     Uri reff = HttpContext.Current.Request.UrlReferrer;
     if (reff != null) {
       //obrazky z ciziho referera neposilat
       int dotPos = requestUrl.LastIndexOf('.');
       if (requestUrl != null && dotPos > 0 && okAuthority.IndexOf(reff.Authority.ToLower()) < 0 && bmpExtensions.IndexOf(requestUrl.Substring(dotPos)) >= 0) return;
       err += "Referrer: " + reff.AbsoluteUri + "\n";
     }
     err += "\n";
     LMCookie cook = LMCookie.DeserializeCookie(ctx);
     if (cook != null)
       err += "UserId=" + cook.id.ToString() + "\n";
   }
   err += eventRaised.ToString();
   Emailer em = new Emailer(null, "*****@*****.**", eventRaised.GetType().Name, err.Replace("\n", "<br/>"));
   //if (err.ToLower().IndexOf("http://vyuka.lide.cz/webresource.axd") > 0) return;
   //em.HTML = err.Replace("\n", "<br/>");
   //em.Subject = eventRaised.GetType().Name;
   //em.From = "*****@*****.**";
   foreach (string mail in mailsTo) em.AddTo(mail);
   em.SendMail();
 }