Dears, I want to attach application logged in user to Session. I found that there is property Session.Configuration.Username. can i set the username property to logged in username ,so that i can access it anywhere. i want to set this property on my Login Page , but how to access Session Object in my login page.

pls help Thanks HAN


Updated at 18.07.2010 12:34:17

Thanks for you reply. As of now, i am storing logged in username in a http session, my audit module is in different assembly, i want audit module to save username in database, i dont want to send http session object to my audit module. if you dont want me to use Session.Username, then how can i get username in audit module.

Any help much appreciated Thanks HAN


Updated at 19.07.2010 8:55:11

Dear Alex, Thanks for your help. I am doing something like this:

private void UpdateDate(long id)
        {
            Gender gender = Query.SingleOrDefault<Gender>(long.Parse(txtCode.Text));                        
                using (var transactionScope = Transaction.Open())
                {
                    Transaction.Current.Session.Extensions.Set(dataContext);                 
                   using (var region = Validation.Disable())
                    {
                        gender.NameEn = txtNameEn.Text;
                        gender.NameAr = txtNameAr.Text;
                        region.Complete();
                    }
                    transactionScope.Complete();
                }
        }

my only question is, do i need to repeat this for all my Create/Update/Delete operations in all my pages. and is this the correct way and correct place of doing it.

Transaction.Current.Session.Extensions.Set(dataContext);

thanks HAN

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 18 '10 at 11:23

HannanKhanji's gravatar image

HannanKhanji
54141317

You can set Session.Name property via SessionConfiguration.Name - it is used in logging.

User name is really unused for now.

(Jul 18 '10 at 11:23) Alex Yakunin Alex%20Yakunin's gravatar image

Sorry, I completely misunderstood the question.

Correct answer is: don't use Session.UserName for now. It is reserved for future implementation of access control system. When it's done, we'll provide appropriate information.

(Jul 18 '10 at 11:23) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

You can use e.g. Session.Extensions property to attach any additional info to Session.

Domain also has the same property. See IHasExtensions interface for details.

answered Jul 18 '10 at 19:45

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Alex,

When do you plan on implementing the security system? Can you provide an ETA? Even a best-guess would suffice.

(Jul 18 '10 at 19:45) ara ara's gravatar image

As far as I can judge, the discussion continues here: viewtopic.php?f=29&t=6023

(Jul 18 '10 at 19:45) Alex Yakunin Alex%20Yakunin's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA