Click here to Skip to main content
15,887,967 members
Home / Discussions / C#
   

C#

 
JokeRe: PolyGon To Shift Right Pin
GlobX10-Apr-11 20:31
GlobX10-Apr-11 20:31 
AnswerRe: PolyGon To Shift Right Pin
Luc Pattyn9-Apr-11 5:55
sitebuilderLuc Pattyn9-Apr-11 5:55 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri10-Apr-11 18:16
Anubhava Dimri10-Apr-11 18:16 
QuestionC# session Pin
adrian salas8-Apr-11 18:09
adrian salas8-Apr-11 18:09 
AnswerRe: C# session Pin
OriginalGriff8-Apr-11 20:36
mveOriginalGriff8-Apr-11 20:36 
GeneralRe: C# session Pin
adrian salas9-Apr-11 3:33
adrian salas9-Apr-11 3:33 
AnswerRe: C# session Pin
Anubhava Dimri8-Apr-11 20:50
Anubhava Dimri8-Apr-11 20:50 
AnswerRe: C# session Pin
dan!sh 9-Apr-11 5:34
professional dan!sh 9-Apr-11 5:34 
If it is a web application, take a look at ASP.Net Role provider and Session management.

If this is a windows based application, you will have to do it on your own.

1. Set up the Role table in the database or configuration file (not recommended) as desired.
2. Then set up a Rights table. This table should essentially have the list of operations that can be performed.
3. Now, create a Role_Right_Map table. This will be 1 to many relation table between Role and Rights. This will define which Role can do what.
4. Now set up a user table. This table will have your user credentials and other details.
5. Next, make a Role_User_map. This can be a one to may relation based table between user and role.

Now, you have your setup ready. Next, when the user logs in, check for the role and corresponding rights. Based on that the available functionality will be decided.

As far as session goes, keep track of the login time in some static variable. You will also need one more static variable say activity tracker. If there is no activity done for certain amount of time, log the user out.

Possible problems in doing this:

1. If it is a desktop application with database on the client computer, anyone can make changes to the Roles and Rights. Suggested resolution can be to encrypt data in those tables.
2. User can change the system datetime which will negate all the session management rules you put in. Suggested resolution can be like this: When the user logs in, start a timer in a different thread. Now, reset the timer on every activity. If the timer has ticked for your session value (say 10 mins), log out the user.
"Your code will never work, Luc's always will.", Richard MacCutchan[^]

AnswerRe: C# session Pin
Ganesh Kumar Kaki13-Apr-11 1:21
Ganesh Kumar Kaki13-Apr-11 1:21 
QuestionWebserver only sending text occasionally? [modified] Pin
venomation8-Apr-11 16:38
venomation8-Apr-11 16:38 
AnswerRe: Webserver only sending text occasionally? Pin
Richard Andrew x649-Apr-11 3:27
professionalRichard Andrew x649-Apr-11 3:27 
GeneralRe: Webserver only sending text occasionally? Pin
venomation9-Apr-11 4:59
venomation9-Apr-11 4:59 
AnswerRe: Webserver only sending text occasionally? Pin
BobJanova11-Apr-11 5:10
BobJanova11-Apr-11 5:10 
QuestionHow to get a value to return in a textbox Pin
Justiin12658-Apr-11 12:15
Justiin12658-Apr-11 12:15 
AnswerRe: How to get a value to return in a textbox Pin
Colin Angus Mackay8-Apr-11 14:15
Colin Angus Mackay8-Apr-11 14:15 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:28
Justiin12658-Apr-11 16:28 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 15:01
sitebuilderLuc Pattyn8-Apr-11 15:01 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:39
Justiin12658-Apr-11 16:39 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 17:10
sitebuilderLuc Pattyn8-Apr-11 17:10 
AnswerRe: How to get a value to return in a textbox Pin
davidnz8-Apr-11 15:32
davidnz8-Apr-11 15:32 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:44
Justiin12658-Apr-11 16:44 
GeneralRe: How to get a value to return in a textbox Pin
Rotted Frog8-Apr-11 22:29
Rotted Frog8-Apr-11 22:29 
Questionthread.interrupt only working once Pin
Member 74021668-Apr-11 10:40
Member 74021668-Apr-11 10:40 
AnswerRe: thread.interrupt only working once Pin
davidnz8-Apr-11 12:13
davidnz8-Apr-11 12:13 
AnswerRe: thread.interrupt only working once Pin
Ganesh Kumar Kaki13-Apr-11 1:27
Ganesh Kumar Kaki13-Apr-11 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.