what is AllowAnonymous attribute in mvc [Resolved]

Posted by mohammedr88-18313 under ASP.NET MVC on 1/18/2014 | Points: 10 | Views : 15592 | Status : [Member] | Replies : 4
Hi all,


Im new to MVC 4 , can anyone tell me what is AllowAnonymous


[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}



thanks in advance




Responses

Posted by: kgovindarao523-21772 on: 1/19/2014 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
Hi,

For ex:
I have three pages named LOGIN,HOME,DETAILS.

suppose that, we can access home, Details pages if we are authorized only.

To provide authorization we are using a login page.

Now, I want to provide authorization using [Authorize] filter defined in Filter.config file.

then Authorization is applied to all pages(login also). Hence we cannot access login page also.

To allow login page access initially, we have to provide [AllowAnonymous] to login page.

Now, login page will open initially, after authorization, we can access remaining two pages

Please mark as answer , if you satisified.

Thank you,
Govind

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chakravarthi on: 1/22/2014 [Member] Starter | Points: 25

Up
0
Down
AllowAnonymous Attribute for specifying those controller actions that can be seen by anonymous(unknown) users

Regards

Chakravarthi

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandrashekarthota on: 5/19/2014 [Member] Starter | Points: 25

Up
0
Down
[AllowAnonymous] - Any one can access view related to the action in controller
[Authorize] - Only registered users or specific set of users can access view related to the action in controller
You can also specify list of users in the attribute to grant access to them


Chandra Shekar Thota
Founder/Developer
www.hyderabadtechies.info

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: mohammedr88-18313 on: 5/19/2014 [Member] Starter | Points: 25

Up
0
Down
thank u

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response