473,508 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add Session varaible in an ordinary class

I'm unable to add a session variable in a non-page class. Any ideas?

I've tried

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session["ABC"] = messageBody;

also

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session.Add("ABC", messageBody");

also

HttpContext current = HttpContext.Current;

current.Session["ABC"] = messageBody;

Ron
Apr 2 '06 #1
1 935
I jsut noticed that it does not work if there no session variables exist. If
I add a different Session variable in a start up page then it works fine.

Ron
"RonL" <ro***@hotmail.com> wrote in message
news:5W*****************@newssvr11.news.prodigy.co m...
I'm unable to add a session variable in a non-page class. Any ideas?

I've tried

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session["ABC"] = messageBody;

also

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session.Add("ABC", messageBody");

also

HttpContext current = HttpContext.Current;

current.Session["ABC"] = messageBody;

Ron

Apr 2 '06 #2

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

Similar topics

3
2338
by: NotGiven | last post by:
Page1 has a form that calls Page2. The beginning of Page2: <? php session_start(); $s=$_POST; session_register("s"); ?> in the middle of Page2 I have a form varaible: <?php echo $_POST; ?>...
1
1942
by: opt_inf_env | last post by:
Hello, I have a page such that each user can see only a corresponding (personal) part of the page. In the beginning I wanted to perform initialization of users (by asking there names and...
3
1751
by: Asif Malik | last post by:
Hi i am new to asp and am having problems accessing a session variable on a secure page (https) the session varaible was created on a non-secure page and when i go i can see that it is still there,...
10
2044
by: Jacob Anderson | last post by:
Hello, I have a web application running in two configurations: 1. On my local machine running in debug and release mode 2. On a shared, hosted, machine in release mode On my local machine,...
4
3167
by: John Smith Jr. | last post by:
Could someone enlighten me what the difference between viewstate[" and session[" variables in terms of use, performance, and rule of thumb, from what I understand viewstate has overhead to it, and...
6
1516
by: Mike | last post by:
I have a function that is called when the user clicks the submit button, during this function i also set a varaible to "Y" due to that this function does a post back to the page then redirects....
7
1730
by: rochagasdiniz | last post by:
I am having a problem configuring a state server session on a Web Farm.When the user records a session variable in one server and tries to read it on another server, I get a null reference...
18
3401
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
7
422
by: Flurry | last post by:
Hello... I have a simple problem...when I create a session variable as such: Session("ID") = 1 and read this varaible from time to time.... The problem is that it is shared by all users...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
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
7385
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...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5629
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
5053
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
3195
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
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.