473,480 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to declare session variable in global.asax file

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

Nov 17 '05 #1
1 19009
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 declaringinterger and string variable and can we also initialize
them at the same time
thanks for help

.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1208
by: Arjen | last post by:
Hi, I use form authentication for my asp.net 2.0 webapplication. When a user request a page it must first load some settings. These settings will be placed inside the context.items. I can add...
1
2069
by: Denon | last post by:
How to terminate a Session in Global.asax? 1)In Global.asax, I have store every sessionID into a global array 2) I have start a timer while application_start event, this timer lookup something 3)...
1
4060
by: D. Shane Fowlkes | last post by:
Tw part question: 1 - Is it <% @Import Namespace..... or <%@ Import Namespace... ? I'm seeing it both ways in a book (but I think one is a typo. My pages don't seem to care which it is. Or do...
14
445
by: paul downing via DotNetMonster.com | last post by:
global file email send -------------------------------------------------------------------------------- guys, i'm developing an application and want to send an email with an error if it occurs...
0
937
by: kingski | last post by:
What is the first event in Global.asax in which I can create/access session in ASP.NET 2.0?
1
1896
by: Groove | last post by:
Hey guys - I'm sure this is a commonly asked question but here goes. I'm trying to catch the error in my global.asax file and redirect to a error page which will email me the actual error upon...
0
3751
by: Alias | last post by:
Hi - I have a site that runs on a development and production server. I'd like to programmatically change the connection string the provider uses in the web.config file and have the provider use...
8
8072
by: yinglcs | last post by:
Hi, I have the following code: colorIndex = 0; def test(): print colorIndex; This won't work. But it works if i do this:
5
14660
by: baburmm | last post by:
Hai, I want to get the Global static name(for Constant) Declared in the Global.asax file for my whole project as a constant. my coding in the Global.asax file is private static string strName =...
0
923
by: Vinnarasi | last post by:
This is the error i get when i try to setup a portal which is built using rainbow portal. The type 'Rainbow.Global' is ambiguous: it could come from assembly...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7043
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7081
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5336
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4776
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.