Home > Net >  Asp.net system login after each page how to get the user permissions?
Asp.net system login after each page how to get the user permissions?

Time:10-10

System each user permissions set by the administrator, everyone may be different, the permissions now meet a problem, in each page how to obtain permission? There are two options, one kind is every page to query the database, every two kind is saved to the session, each time the session to obtain; First feeling will affect the performance, the second session save more information also affects performance, consult everybody if there is any other better solutions?

CodePudding user response:

Is not saved in the session is stored in the redis this cache,
Anyway, don't go brush every page to open the database take,

CodePudding user response:

And, says performance problems, reasoning is very pale,
You every day how much traffic, peak is how much?
Are taken into account the performance problems, that still struggling with the session or cache to store permissions, funny,

CodePudding user response:

refer to the original poster hhwh2008 response:
system each user permissions set by the administrator, everyone may be different, the permissions now meet a problem, in each page how to obtain permission? There are two options, one kind is every page to query the database, every two kind is saved to the session, each time the session to obtain; First feeling will affect the performance, the second session save more information also affects performance, consult everybody if there is any other better solutions?

Just another interface inheritance

CodePudding user response:

Permissions you can divide categories, a system can have how many kinds? Are put in the SESSION, which can determine the current user belongs to the categories, if you want to be subdivided in categories, then you can set another classification, different classification also exists in the SESSION, this way, you can get A X B kind of combination of permissions, then there is the program can also add some condition limit some operations, such as when the LIST is empty, can't modify, delete, and so on, actually. NET and A method of permissions through WEB. CONIFG role to control, and each folder containing A WEB. CONFIG file, which has allowed and not allowed to access the role of, when the system running, the corresponding is not the role of cannot enter all of the pages of this folder, jump straight to the specified page (landing page) can look up the relevant information,

CodePudding user response:

Features, can be used in feature according to login ID to assign permissions

CodePudding user response:

After logging in, set your PermissionList to HttpContext. The Session, in this way, every time the user access, you can directly from the Session to obtain PermissionList inside, users log out, Clear the Session,

CodePudding user response:

Access to the database is a must, it is suggested that using Cookies, don't use the session

CodePudding user response:

How much is the first user, the server is what kind of, if use just a few hundred people use or thousands, and database also do not have what effect, have no experience at all of performance,
As well as real time,

If stored in the session or cookie the administrator to modify the permissions, in the case of no exit is not A always have permission, do you have any requirement system for real-time

Deposited in redis or directly use the.net cache operation, the administrator when modify permissions to code and to consider the cache and consistency of database, to operate 2,

So in the case of performance enough well, every page down the database to connect to the database switch control even if the release is no problem,

, of course, if you have a real time is a day that can operate database, then the cache Settings for 24 hours, so that each page cache judgment will go, also won't tube the latest permission problems, but at the time of increased access to someone is a tragedy, the administrator to add, after the people still can't find in the cache

But I still that sentence, don't early to consider performance, just add trouble to oneself, should consider is expanded, interface, don't write the program dead

CodePudding user response:

reference 1st floor is nu month god reply:
is not saved in the session is stored in the redis this cache,
Anyway, don't go brush every page open database, of taking


In the SESSION, the administrator at the time of editing A permissions, A would have been no, unless back into,

If it is for A cancel permissions, has not been A refund, that is not canceled, do you think of that, A great god

CodePudding user response:

Company with the system seems to be every time to check the database...

CodePudding user response:

curiosity, 9/f, reference is to learn response:
Quote: refer to 1st floor is nu month god reply:

Is not saved in the session is stored in the redis this cache,
Anyway, don't go brush every page open database, of taking


In the SESSION, the administrator at the time of editing A permissions, A would have been no, unless back into,

If it is for A cancel permissions, has not been A refund, it is not cancelled, what do you think of that, A great god

Authority is original is not necessarily the real time,
Because of permission changes, may not be too frequent,
As for to meet the real-time requirements of you said, actually very simple also, whether the session or cache,
Can refresh or against doing dependency to solve this problem,

  • Related