How to make a beta access page, for example, on superuser.com?

I work with ASP.Net MVC and I would like to make the website accessible over the Internet, but only for a select few people right now. I want to do something basically exactly the same as on the beta access page with a password, as well as in stackoverflow, serverfault and superuser.

I do not just want to check and redirect in the home controller, I want it to always go there, no matter what URL is used.

Does anyone know how they do this?

+3
source share
3 answers

MVC , , , OnActionExecuting OnAuthorization.

+1

, AuthorizeAttribute. /, , . , Open/Closed.

AuthorizeCore, / cookie/ , , AuthorizeCore.

+1

An easy way is to put something in a user session. Run the check either on the main page or in the http handler to make sure that this session is true or not. If not redirected to the password capture page. When a password is provided, set the session variable ... wa la they are.

If you want to remember them, also discard the cookie and add it to your check.

0
source

Source: https://habr.com/ru/post/1715358/


All Articles