c# - How to authorize using windows authentication in ASP.net 5 -
i creating application going use windows authentication allow access page based on user , roles. have gone ahead , configured iis use windows authentication , disabled anonymous access. able browse application without issue , have enabled windows authentication application.
now trying set access controller level using authorize
, unable figure out how works asp.net 5. new asp / c# programming platform did search online resources , came across this , used below example give try red squiggly line under users
, think asp.net 5 unable find users
. made sure have added references @ top.
[authorize(users = @"contoso\rick, contoso\keith, contoso\mike")]
references:
using microsoft.aspnet.mvc; using rmdaautomation.models.repository; using rmdaautomation.models.entity; using microsoft.aspnet.authorization;
any suggestions highly appreciated. :)
update 1:
tutorialscontroller.cs:
using microsoft.aspnet.mvc; using microsoft.aspnet.authorization; namespace rmdaautomation.controllers.web { public class tutorialscontroller : controller { [authorize(roles = @"domain\group")] public iactionresult index() { return view(); } } }
tutorial index view:
<div class="container"> <h1>tutorials</h1> </div>
using system.web.mvc;
this using solves issue in project
Comments
Post a Comment