Skip to content

Instantly share code, notes, and snippets.

View NamelessG0d's full-sized avatar
🏠
Working from home

NamelessGod NamelessG0d

🏠
Working from home
View GitHub Profile
@NamelessG0d
NamelessG0d / AccessLevelAttribute.cs
Last active February 16, 2023 21:04
Custom Controller Attribute to execute code before execution (C# Asp.Net Mvc)
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Security.Claims;
namespace ASP.Attributes
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class AccessLevelAttribute : ActionFilterAttribute
{
private readonly int _role_level;