D
D
Devil Devil2016-07-16 20:26:22
ASP.NET
Devil Devil, 2016-07-16 20:26:22

How to set permissions in web.config file?

Good day!
When implementing authentication / authorization on the site, such a problem arose
when you log out of your account, then some actions should be unavailable, NOOO
if you go to these "forbidden" actions by the address bar, then everything is available
how to fix it?
the internet says

<authorization>
        <deny users="?" />
      </authorization

but then there is such an error:
c4d2150468e04ee9a98bac935f7e7cf4.JPG
but there is nothing like that in that file (((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanostee, 2016-07-16
@BarkovA

In my opinion in MVC it ​​is better to use AuthorizeAttribute

[Authorize]
public ActionResult Index()
{
    ...
}

[Authorize (Users="admin")]
public ActionResult Edit()
{
    ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question