Akismet.Umbraco 5.0.0-beta1

This is a prerelease version of Akismet.Umbraco.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Akismet.Umbraco --version 5.0.0-beta1                
NuGet\Install-Package Akismet.Umbraco -Version 5.0.0-beta1                
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="5.0.0-beta1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Akismet.Umbraco --version 5.0.0-beta1                
#r "nuget: Akismet.Umbraco, 5.0.0-beta1"                
#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=5.0.0-beta1&prerelease

// Install Akismet.Umbraco as a Cake Tool
#tool nuget:?package=Akismet.Umbraco&version=5.0.0-beta1&prerelease                

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

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 net8.0 is compatible.  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 431 12/28/2023
5.0.0-beta1 408 12/18/2023
4.0.3 660 8/18/2023
4.0.2 545 8/18/2023
4.0.1 603 8/18/2023
4.0.0 553 8/17/2023
3.0.1 812 1/11/2023
3.0.0 801 1/6/2023
2.0.0.1 1,005 6/28/2022
2.0.0 1,027 6/28/2022
2.0.0-beta2 614 6/28/2022
2.0.0-beta1 623 6/15/2022
1.0.0 1,183 10/1/2021

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