Akismet.Umbraco 4.0.3

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Akismet.Umbraco --version 4.0.3
NuGet\Install-Package Akismet.Umbraco -Version 4.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Akismet.Umbraco" Version="4.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Akismet.Umbraco --version 4.0.3
#r "nuget: Akismet.Umbraco, 4.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Akismet.Umbraco as a Cake Addin
#addin nuget:?package=Akismet.Umbraco&version=4.0.3

// Install Akismet.Umbraco as a Cake Tool
#tool nuget:?package=Akismet.Umbraco&version=4.0.3

Akismet Management for Umbraco 9+

Adds Akismet dashboard to Umbraco backoffice.

image

Note: This package for Umbraco 9+ only. Check here for Umbraco 8

Installation

Install via NuGet

Install-Package Akismet.Umbraco

NuGet Status

Note: installing packages via the backoffice will not be available beginning with Umbraco 9

Post-Installation

After package installation, log into the backoffice and navigate to Users, Groups, Administrators and be sure to add Akismet.

image

Usage

Once installed, the AkismetService service becomes available for checking comments. It is up to the developer to wire up to the contact forms but here is an abbreviated example:

using Akismet.NET;
using Akismet.Umbraco;

public class ContactFormController : SurfaceController
{
    private readonly AkismetService AkismetService;
    
    public ContactFormController(AkismetService akismetService)
    {
        AkismetService = akismetService;
    }

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult SubmitForm(ContactModel model)
    {
        // check validation
        // eg - required fields, captcha, etc
        
        string ip = Request.Headers["CF-Connecting-IP"] ?? Request.UserHostAddress;
        if (String.IsNullOrWhiteSpace(ip))
            ip = Request.ServerVariables["REMOTE_HOST"];

        // see https://github.com/ahwm/Akismet.Net for all available options
        AkismetComment comment = new AkismetComment
        {
            CommentAuthor = model.Name,
            CommentAuthorEmail = model.EmailAddress,
            Referrer = Request.UrlReferrer.ToString(),
            UserAgent = Request.UserAgent,
            UserIp = ip,
            CommentContent = model.Message,
            CommentType = AkismentCommentType.ContactForm,
            Permalink = CurrentPage.Url(mode: UrlMode.Absolute)
        };
        
        // Specify true on CheckComment() to not include "Unspecified" as valid comments
        bool isValid = AkismetService.CheckComment(comment, true);
        if (!isValid)
        {
            return CurrentUmbracoPage();
        }
        
        // continue processing
    }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0-beta2 385 12/28/2023
5.0.0-beta1 374 12/18/2023
4.0.3 607 8/18/2023
4.0.2 512 8/18/2023
4.0.1 571 8/18/2023
4.0.0 525 8/17/2023
3.0.1 772 1/11/2023
3.0.0 752 1/6/2023
2.0.0.1 949 6/28/2022
2.0.0 994 6/28/2022
2.0.0-beta2 587 6/28/2022
2.0.0-beta1 590 6/15/2022
1.0.0 1,153 10/1/2021

Support for Umbraco 12; please report issues at https://github.com/ahwm/Akismet.Umbraco/issues