---
title: Flood protection
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Flood control is a form of spam prevention on forums and similar community services. It prevents the users from making posts to the forum in quick successions. The users usually have to wait for a short time period before making another post. This mechanism prevents spambots from flooding the forum with unsolicited messages.

Whenever a user makes a post, the mechanism checks, if the minimal time interval between posts has been exceeded. If the interval has been exceeded, the post is not saved. The checks can be performed against:

- **userID** (User based) - default for logged-in users.
- **IP** (IP based) - default for users that are not logged-in.

You can change the default settings using the [CMSUserBasedFloodProtection ](https://docs.kentico.com/k81/references/reference-web-config-application-keys.md#security-settings)web.config key.

## Supported application

The flood protection is supported in the following applications:

- Blogs (comments)
- Forums (posts)
- Message boards (posts)
- Messaging (sending messages)

This mechanism works across all applications, so if a user gets blocked after posting comments on blogs, the user is also blocked on Forums, Message boards and in the Messaging application.

> **Note:** **Do not forget to use CAPTCHA**
>
> In addition to securing the applications using flood protection, you should also include a CAPTCHA field in the comment, post and message forms.

### Enabling and configuring the flood protection

You can enable the flood protection functionality in **Settings -> Security & Membership -> Protection -> Flood protection** section.

Using the **Flood protection interval**, you can set the minimum time interval (in seconds) before the user can make another post.

### Chat application

The Chat application has its own flood protection system. It is more complex and granular. The checks are performed when the user:

- creates a room,
- joins a room,
- posts a message,
- changes the nickname.

The checks are performed against the chat user ID. Chat also has its own **Flood protection** section in **Settings -> Community -> Chat**. See [Settings - Chat](https://docs.kentico.com/k81/configuring-kentico/managing-sites/configuring-settings-for-sites/settings-community/settings-chat.md).

## Flood protection integration

If you want to integrate this mechanism in your own code, use the _FloodProtectionHelper.CheckFlooding_ method:

```csharp

using CMS.Membership;
using CMS.SiteProvider;

...

if (FloodProtectionHelper.CheckFlooding(SiteContext.CurrentSiteName, MembershipContext.AuthenticatedUser))
{
    // Don't save the message, display information about flooding to the user
}

// Save the message and continue

```
