Click here to Skip to main content
15,885,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web api that I want to restrict the access to it using the forms based authentication. I am newbie at asp.net mvc. I want to know what is the best way to secure the web api using the forms based authentication. I hope for a little help with some code examples.
Posted

1 solution

Dear Naufal07,

On the top of your controller's method you just typed:

C#
[Authorize(Roles = "Administrator")] or [Authorize]


if that controller's method used by Administrator.

or


C#
[Authorize]


on the top of your controller just before
public class <controller name=""></controller>


your all method of controller become secure.

Thank You,
Manoj Kalla
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900