Esempio n. 1
0
        public void MarkSpam(PostComments.Comment comment)
        {
            //Create a new instance of the Akismet API and verify your key is valid.
            string blog = ConfigurationManager.AppSettings["MainUrl"];
            var api = new Akismet(akismetKey, blog, comment.UserAgent);
            if (!api.VerifyKey()) throw new Exception("Akismet API key invalid.");

            var akismetComment = new AkismetComment
            {
                Blog = blog,
                UserIp = comment.UserHostAddress,
                UserAgent = comment.UserAgent,
                CommentContent = comment.Body,
                CommentType = "comment",
                CommentAuthor = comment.Author,
                CommentAuthorEmail = comment.Email,
                CommentAuthorUrl = comment.Url,
            };

            #if !DEBUG
            api.SubmitSpam(akismetComment);
            #endif
        }
Esempio n. 2
0
		public static void MarkSpam(PostComments.Comment comment)
		{
			var api = new Akismet(AkismetKey, BlogUrl, comment.UserAgent);
			if (!api.VerifyKey()) throw new Exception("Akismet API key invalid.");

			var akismetComment = new AkismetComment
			{
				Blog = BlogUrl,
				UserIp = comment.UserHostAddress,
				UserAgent = comment.UserAgent,
				CommentContent = comment.Body,
				CommentType = "comment",
				CommentAuthor = comment.Author,
				CommentAuthorEmail = comment.Email,
				CommentAuthorUrl = comment.Url,
			};

#if !DEBUG
			api.SubmitSpam(akismetComment);
#endif
		}