Skip to content

Controller's Attribute

REST API Settings

program.cs
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

var app = builder.Build();

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();

Attributes

Controllers
 [ApiController]
 [Route("[controller]")]
Actions
 [Authorize]
 [AllowAnonymous]
 [HttpGet]
 [HttpPost]
 [Route("Index")]
 [ActionName("Confirm")]
Preventing a Public Method from Being Invoked
[NonAction]