locked
login RRS feed

  • Question

  • how do i store the user login detail for window login? i used to have that stored in session for web, but for window login?
    Saturday, December 5, 2009 2:39 AM

Answers

  • Each instance of an Windows application will run in a different application domain, so your static variables are specific to the instance of running program in windows applications.

    Just make a sample application and assign a value to a  static variable and try to access it from other, you'll see.

    • Marked as answer by Harry Zhu Thursday, December 10, 2009 3:51 AM
    Saturday, December 5, 2009 2:59 AM
  • Hi,

    You can store it in a static variable and access it from anywhere in windows applications.

    ex

    public class ApplicationVariables
    {
    public static string UserName="";
    }

    You can access it by ApplicationVariables.UserName="Foo"; or string s=ApplicationVariables.UserName;
    • Proposed as answer by JediJohn82 Saturday, December 5, 2009 2:58 AM
    • Marked as answer by Harry Zhu Thursday, December 10, 2009 3:51 AM
    Saturday, December 5, 2009 2:42 AM

All replies

  • Hi,

    You can store it in a static variable and access it from anywhere in windows applications.

    ex

    public class ApplicationVariables
    {
    public static string UserName="";
    }

    You can access it by ApplicationVariables.UserName="Foo"; or string s=ApplicationVariables.UserName;
    • Proposed as answer by JediJohn82 Saturday, December 5, 2009 2:58 AM
    • Marked as answer by Harry Zhu Thursday, December 10, 2009 3:51 AM
    Saturday, December 5, 2009 2:42 AM
  • but storing that in static class will not able to handle the multiuser login . waht if my system supports multiple user login?
    Saturday, December 5, 2009 2:48 AM
  • Tamer Oz is dead on for a normal windows application.

    If it is a client-server windows application where you store the login information on the server you can do the following: Hashtable using the user's id as the key and the user profile object in the value.


    Saturday, December 5, 2009 2:58 AM
  • Each instance of an Windows application will run in a different application domain, so your static variables are specific to the instance of running program in windows applications.

    Just make a sample application and assign a value to a  static variable and try to access it from other, you'll see.

    • Marked as answer by Harry Zhu Thursday, December 10, 2009 3:51 AM
    Saturday, December 5, 2009 2:59 AM