You are developing an ASP.NET MVC application that uses forms authentication. The user database contains
a user named LibraryAdmin.
You have the following requirements:
You must allow all users to access the GetBook method.
You must restrict access to the EditBook method to the user named LibraryAdmin.
You need to implement the controller to meet the requirements.
Which code segment should you use? (Each correct answer presents a complete solution. Choose all that
apply.)
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Actually I don’t think C is correct as unless the admin has logged in, it will loop forever
Answer is Correct.
It will not loop forever, the user is going to be redirected to the login page, where the login logic will take care of it.
Any user different from admin is going to be redirected to account/login. If login is successful, the user is going to be redirected to returnUrl.