c# - _start.cshtml view is not executing -
i using asp.net mvc-4
in application. have created controller, eample person , in controller have 3 actions example getname, getage , getdateofbirth. want place check user not loggedin can't access these action view.
for trying use _start.cshtml
view. placed inside views/person/
, expecting whenever user access view inside person folder _start.cshtml
view should run before other view. , in *_start.cshtml* placed code check whether current user logged in or not. _star.cshtml not executing.
can please tell me doing wrong ?
now want place check user not loggedin can't access these action view
that's absolutely not should done in views on controller actions, decorating them [authorize]
attribute. example:
[authorize] public actionresult someaction() { ... }
and have possibility specify 1 or more roles:
[authorize(roles = "admin")] public actionresult someaction() { ... }
you decorate controller attribute mean actions in require authorization.
Comments
Post a Comment