how to declare session variable in global.asax file

Discussion in 'ASP .Net' started by khawar, Jul 10, 2003.

  1. khawar

    khawar Guest

    please provide code sample, i was having trouble declaring
    interger and string variable and can we also initialize
    them at the same time
    thanks for help
     
    khawar, Jul 10, 2003
    #1
    1. Advertisements

  2. khawar

    GastonQ Guest

    Hi khauar, I provide you with a sample that store and
    require variables in a Session object.

    To save the variables...

    string s = "String Value";
    int i = 23; // My lucky number;

    Session[ "stringValue" ] = s;
    Session[ "intValue" ] = i;
    ....

    To get the values...

    string s2 = ( string ) Session[ "stringValue" ];
    int i2 = ( int ) Session[ "intValue" ];

    Regards
    Gaston Quirque
    Microsoft MVP

    >-----Original Message-----
    >please provide code sample, i was having trouble

    declaring
    >interger and string variable and can we also initialize
    >them at the same time
    >thanks for help
    >
    >.
    >
     
    GastonQ, Jul 10, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    1
    Views:
    1,054
    Alvin Bruney
    Jul 29, 2003
  2. Daniel Bass
    Replies:
    2
    Views:
    7,258
    Daniel Bass
    Dec 31, 2003
  3. 2obvious

    no global constants in global.asax?

    2obvious, Sep 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,176
  4. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    1,275
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  5. Daves

    global.asax or global.ascx?

    Daves, Mar 15, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    4,391
    Scott M.
    Mar 16, 2005
  6. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,531
    Mark Rae
    May 23, 2006
  7. shark_bait
    Replies:
    0
    Views:
    983
    shark_bait
    Jul 17, 2006
  8. Replies:
    1
    Views:
    3,696
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Sep 25, 2007
Loading...