file-handling

Installation
SKILL.md

Rationale

File handling is a common requirement but presents significant security and scalability challenges. Improper implementation can lead to security vulnerabilities (path traversal, malicious uploads), memory exhaustion, and storage inefficiencies. These patterns provide secure, performant, and maintainable approaches to file operations in Razor Pages.

Patterns

Pattern 1: Secure File Upload Validation

Implement comprehensive validation for file uploads including type, size, and content verification.

public class FileUploadValidator
{
    private readonly long _maxFileSize;
    private readonly string[] _allowedExtensions;
    private readonly Dictionary<string, byte[]> _fileSignatures;

    public FileUploadValidator(IConfiguration configuration)
    {
Related skills

More from wshaddix/dotnet-skills

Installs
21
GitHub Stars
23
First Seen
Mar 7, 2026