> ## Documentation Index
> Fetch the complete documentation index at: https://ancplua.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AL0022 - Mixed form collection and DTO

> Mixing IFormCollection with a [FromForm] DTO is not supported

Source: [AL0020ToAL0024FormBindingAnalyzer.cs](https://github.com/ANcpLua/ANcpLua.Analyzers/blob/main/src/ANcpLua.Analyzers/Analyzers/AL0020ToAL0024FormBindingAnalyzer.cs)

## Description

Mixing IFormCollection with a \[FromForm] DTO is not supported. Choose one approach: use IFormCollection for dynamic form access or a typed DTO for structured binding.

## Bad Code

```csharp theme={null}
([FromForm] UserDto user, [FromForm] IFormCollection form)
```

## Good Code

```csharp theme={null}
([FromForm] UserDto user) // choose one approach
```

## Properties

* **Category**: ASP.NET Core
* **Severity**: Error
* **Enabled by default**: True
* **Code fix available**: False

## Configuration

```editorconfig theme={null}
dotnet_diagnostic.AL0022.severity = warning
```
