Luis Valencia
Luis Valencia

Reputation: 33988

How to restrict some views/actions to logged in users?

I created a new controller called Dashboard and a View called Index which says, Hello Username.

In MVC, how can I make this only available to logged in users?

Upvotes: 0

Views: 164

Answers (1)

von v.
von v.

Reputation: 17108

You can use the Authorize attribute:

[Authorize]
public ActionResult Index()
{
}

Upvotes: 4

Related Questions