InterviewSolution
Saved Bookmarks
| 1. |
Consider that you are developing an application that uses forms authentication in ASP.NET MVC. |
|
Answer» A user named AdminLibrary is present in the user database. You will have the requirements as FOLLOWS: - All users must be allowed to access the obtainBook() method. - Access to the modifyBook() method must be restricted for the AdminLibrary user. The controller must be implemented to meet the requirements. Which CODE segment will be USED by you? [Authorize]public class LibraryControllerDemo:Controller{ [Allowanonymous] public ACTIONRESULT obtainBook() { return VIEW(); } [Authorize("AdminLibrary")] public actionresult modifyBook() { return view(); }}[Allowanonymous] - It will allow all users to access the obtainBook() method. |
|