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. Advertising

  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. Advertising

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:
    768
    Alvin Bruney
    Jul 29, 2003
  2. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    801
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  3. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,139
    Mark Rae
    May 23, 2006
  4. shark_bait
    Replies:
    0
    Views:
    861
    shark_bait
    Jul 17, 2006
  5. Replies:
    1
    Views:
    3,394
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Sep 25, 2007
Loading...

Share This Page