Click here to Skip to main content
15,914,221 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to add a number to Left top Of a td Element Pin
mhd.sbt23-Oct-14 10:03
mhd.sbt23-Oct-14 10:03 
AnswerRe: How to add a number to Left top Of a td Element Pin
jkirkerx23-Oct-14 12:50
professionaljkirkerx23-Oct-14 12:50 
AnswerRe: How to add a number to Left top Of a td Element Pin
Swinkaran26-Oct-14 17:32
professionalSwinkaran26-Oct-14 17:32 
GeneralRe: How to add a number to Left top Of a td Element Pin
mhd.sbt29-Oct-14 8:17
mhd.sbt29-Oct-14 8:17 
AnswerRe: How to add a number to Left top Of a td Element Pin
Arunima Panda28-Oct-14 3:03
Arunima Panda28-Oct-14 3:03 
AnswerRe: How to add a number to Left top Of a td Element Pin
Jugdeep Singh Sidana28-Oct-14 19:54
Jugdeep Singh Sidana28-Oct-14 19:54 
QuestionUser Sessions Override each other Pin
Vimalsoft(Pty) Ltd20-Oct-14 23:55
professionalVimalsoft(Pty) Ltd20-Oct-14 23:55 
AnswerRe: User Sessions Override each other Pin
Richard Deeming21-Oct-14 1:40
mveRichard Deeming21-Oct-14 1:40 
Vuyiswa Maseko wrote:
store this in a Static object.

There's your problem - static fields are shared between all threads for all requests to your application. When another user logs in, you replace the value of the static field, and all users will see the information for the last user to log in.

Use the user's Session[^] instead:
C#
public static class UserInfoFacade
{
    private const string UserInfoKey = "Some-Unique-Key-Here";
    
    public static UserInfo GetUserInfo(this HttpContext context)
    {
        if (context == null) throw new ArgumentNullException("context");
        
        HttpSessionState session = context.Session;
        if (session == null) return null;
        
        return (UserInfo)session[UserInfoKey];
    }
    
    public static void SetUserInfo(this HttpContext context, UserInfo info)
    {
        if (context == null) throw new ArgumentNullException("context");
        
        HttpSessionState session = context.Session;
        if (session == null || session.IsReadOnly)
        {
            throw new InvalidOperationException("Session is not enabled, or is read-only.");
        }
        
        session[UserInfoKey] = info;
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: User Sessions Override each other Pin
Vimalsoft(Pty) Ltd21-Oct-14 22:11
professionalVimalsoft(Pty) Ltd21-Oct-14 22:11 
QuestionThe Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file Pin
lan160720-Oct-14 19:52
lan160720-Oct-14 19:52 
AnswerRe: The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file Pin
Praneet Nadkar20-Oct-14 19:57
Praneet Nadkar20-Oct-14 19:57 
GeneralRe: The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file Pin
lan160720-Oct-14 22:02
lan160720-Oct-14 22:02 
Questionmicrosoft jscript runtime error out of memory Pin
ayah abuzaid18-Oct-14 20:30
ayah abuzaid18-Oct-14 20:30 
SuggestionRe: microsoft jscript runtime error out of memory Pin
Kornfeld Eliyahu Peter18-Oct-14 21:16
professionalKornfeld Eliyahu Peter18-Oct-14 21:16 
GeneralRe: microsoft jscript runtime error out of memory Pin
ayah abuzaid18-Oct-14 23:27
ayah abuzaid18-Oct-14 23:27 
AnswerRe: microsoft jscript runtime error out of memory Pin
Nathan Minier20-Oct-14 2:12
professionalNathan Minier20-Oct-14 2:12 
QuestionWeb API ObservableCollection Returns Null Pin
Kevin Marois18-Oct-14 18:23
professionalKevin Marois18-Oct-14 18:23 
SuggestionRe: Web API ObservableCollection Returns Null Pin
Kornfeld Eliyahu Peter18-Oct-14 21:12
professionalKornfeld Eliyahu Peter18-Oct-14 21:12 
AnswerRe: Web API ObservableCollection Returns Null Pin
Nathan Minier20-Oct-14 2:19
professionalNathan Minier20-Oct-14 2:19 
QuestionCODE TO SELECT MULTIPLE ITEMS DISPLAYING IN A WEBPAGE IN ASP.NET Pin
KishoreRoyal17-Oct-14 19:17
professionalKishoreRoyal17-Oct-14 19:17 
AnswerRe: CODE TO SELECT MULTIPLE ITEMS DISPLAYING IN A WEBPAGE IN ASP.NET Pin
Kornfeld Eliyahu Peter18-Oct-14 8:48
professionalKornfeld Eliyahu Peter18-Oct-14 8:48 
AnswerRe: CODE TO SELECT MULTIPLE ITEMS DISPLAYING IN A WEBPAGE IN ASP.NET Pin
jkirkerx18-Oct-14 11:52
professionaljkirkerx18-Oct-14 11:52 
QuestionPublic Enum with strings Pin
byka17-Oct-14 5:59
byka17-Oct-14 5:59 
AnswerRe: Public Enum with strings Pin
ZurdoDev17-Oct-14 8:45
professionalZurdoDev17-Oct-14 8:45 
GeneralRe: Public Enum with strings Pin
byka17-Oct-14 9:46
byka17-Oct-14 9:46 

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.