473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Problem with storing value in Session object/variable


Hey guys,

I'm having problems with creating/storing a value in a session variable for
later retrieving on another page.
Here is the aspx page where I create/store the value

<%Session["type"]="programming";%>
<asp:HyperLink id="hlnkProgramming"Target="main"
NavigateUrl="CategoryResults.aspx">Programming</asp:Hyperlink>

In the CategoryResults.aspx page I just have a Datagrid, and in the
CategoryResults.aspx.cs file I want to retrieve the value as below, however
no session value is ever stored.

string lSql;

if(Session["type"].Equals("programming"))
{

lSql = "Select * from Products where type = 'Programming'";
}
I thought you can create/store a value in a session variable on any aspx
page, and then retrieve that in any page of your whole application.

Any ideas ?

Thanks,
Al
Nov 19 '05 #1
2 1729
Al:
Don't know what to tell you other than it works for me. I turned tracing on
and checked Response.Wrote the session and everything worked...turn on
tracing and take a look...

Browser settings might be to blame...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Al Wilkerson" <ac***@comcast.net> wrote in message
news:dL********************@comcast.com...

Hey guys,

I'm having problems with creating/storing a value in a session variable for later retrieving on another page.
Here is the aspx page where I create/store the value

<%Session["type"]="programming";%>
<asp:HyperLink id="hlnkProgramming"Target="main"
NavigateUrl="CategoryResults.aspx">Programming</asp:Hyperlink>

In the CategoryResults.aspx page I just have a Datagrid, and in the
CategoryResults.aspx.cs file I want to retrieve the value as below, however no session value is ever stored.

string lSql;

if(Session["type"].Equals("programming"))
{

lSql = "Select * from Products where type = 'Programming'";
}
I thought you can create/store a value in a session variable on any aspx
page, and then retrieve that in any page of your whole application.

Any ideas ?

Thanks,
Al

Nov 19 '05 #2
Session information is stored "InProc" by default. You can check the
web.config file to see if that is how it is setup for your application.
This means that the session information is stored within the aspnet
worker process (aspnet_wp.exe or w3wp.exe depending on your OS). If the
process is recycled for any reason that session information will be
lost. Also if your application is setup to run in a web garden or to
use multiple worker processes, session information would not be the
same amongst all the processes.

Take a look here for more information:
http://support.microsoft.com/kb/307598#2

Nov 19 '05 #3

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

Similar topics

3
by: Sean | last post by:
HI, I have a shopping cart in which I am trying to use breadcrumb style navgiation. I need to be able to display the categroy heading relating to the section of the site a visitor is using i.e...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
14
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
3
by: MrShovel | last post by:
I'm new to this ASP.NET caper and have the following questions. I have a TestObject that contains about 50 fields of data and 3 member procedures. Below is a simplified explanation of what I do....
3
by: Brad | last post by:
I am storing an array which contains about a dozen chracter items to a Session variable. Later, I need to use this array so I am doing the following: Dim eventTypes As String() =...
8
by: rgparkins | last post by:
Hi I am creating a sign-up process on a web site much like that of a wizard form. I have browsed many sites to look for examples of how to store the entry data, so that the user can go back and...
3
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...

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.