Last active
June 29, 2020 23:23
-
-
Save PradeepLoganathan/67ec9c468a0b61efec75728ebbe53911 to your computer and use it in GitHub Desktop.
asp.net core controller with enable cors attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ApiController] | |
| [Route("api/[controller]")] | |
| [Produces("application/json")] | |
| [AllowAnonymous] | |
| [EnableCors(CORSPolicies.PublicApi)] | |
| public class PublicApiControllerBase : ControllerBase | |
| { | |
| [DisableCors] | |
| [HttpGet] | |
| public ActionResult<IEnumerable<string>> Get() | |
| { | |
| return new string[] { "hello", ".net Core 3.1" }; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment