473,804 Members | 3,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session not working

For some reason my Session state stopped working in my webpages. I cannot
pass a variable from one webpage to another using the Session. For example:

Web page 1:

Session["filepath"] = dbname;
Response.Redire ct("Webpage2") ;

Webpage 2:

protected string filepath;
private void Page_Load(objec t sender, System.EventArg s e)
{
filepath = (Session["filepath"]).ToString();

I receive the following message when the above instruction is reached
"Object reference not set to an instance of an object."
Can anyone tell me why this is happening? This has been working for 2 years
and now it is not! Some environmental variable must have changed but what?
Sep 20 '06 #1
4 1929
are the pages in the same application, depending on the IIS application
protection setting session may not be shared across applications
--
mg
"Parrot" wrote:
For some reason my Session state stopped working in my webpages. I cannot
pass a variable from one webpage to another using the Session. For example:

Web page 1:

Session["filepath"] = dbname;
Response.Redire ct("Webpage2") ;

Webpage 2:

protected string filepath;
private void Page_Load(objec t sender, System.EventArg s e)
{
filepath = (Session["filepath"]).ToString();

I receive the following message when the above instruction is reached
"Object reference not set to an instance of an object."
Can anyone tell me why this is happening? This has been working for 2 years
and now it is not! Some environmental variable must have changed but what?
Sep 20 '06 #2
Yes. The pages are in the same application. This system has been running
for 2 years and I really don't know what I could have done to make the
Sessions stop sharing.

"mikegellis " wrote:
are the pages in the same application, depending on the IIS application
protection setting session may not be shared across applications
--
mg
"Parrot" wrote:
For some reason my Session state stopped working in my webpages. I cannot
pass a variable from one webpage to another using the Session. For example:

Web page 1:

Session["filepath"] = dbname;
Response.Redire ct("Webpage2") ;

Webpage 2:

protected string filepath;
private void Page_Load(objec t sender, System.EventArg s e)
{
filepath = (Session["filepath"]).ToString();

I receive the following message when the above instruction is reached
"Object reference not set to an instance of an object."
Can anyone tell me why this is happening? This has been working for 2 years
and now it is not! Some environmental variable must have changed but what?
Sep 21 '06 #3
Parrot wrote:
For some reason my Session state stopped working in my webpages. I cannot
pass a variable from one webpage to another using the Session. For example:

Web page 1:

Session["filepath"] = dbname;
Response.Redire ct("Webpage2") ;

Webpage 2:

protected string filepath;
private void Page_Load(objec t sender, System.EventArg s e)
{
filepath = (Session["filepath"]).ToString();

I receive the following message when the above instruction is reached
"Object reference not set to an instance of an object."
Can anyone tell me why this is happening? This has been working for 2 years
and now it is not! Some environmental variable must have changed but what?
Is the code in Web page 1 new, and are you using normal sessions
(rather than cookieless)?

There are some issues with setting up a new session and then
immediately redirecting, using the default cookie sessions, since
ASP.Net can't set the cookie and send the redirect simultaneously, so
it throws the cookie away and you get a new session on the second page.

Damien

Sep 21 '06 #4
There is no new code in webpage 1. That is why I am perplexed as the Session
was working. I checked for Session.IsCooki eless and it is false. Does that
mean anything? I don't understand how to differentitate between a normal
session and a cookieless session. Is that something I can control with
parameters?

"Damien" wrote:
Parrot wrote:
For some reason my Session state stopped working in my webpages. I cannot
pass a variable from one webpage to another using the Session. For example:

Web page 1:

Session["filepath"] = dbname;
Response.Redire ct("Webpage2") ;

Webpage 2:

protected string filepath;
private void Page_Load(objec t sender, System.EventArg s e)
{
filepath = (Session["filepath"]).ToString();

I receive the following message when the above instruction is reached
"Object reference not set to an instance of an object."
Can anyone tell me why this is happening? This has been working for 2 years
and now it is not! Some environmental variable must have changed but what?

Is the code in Web page 1 new, and are you using normal sessions
(rather than cookieless)?

There are some issues with setting up a new session and then
immediately redirecting, using the default cookie sessions, since
ASP.Net can't set the cookie and send the redirect simultaneously, so
it throws the cookie away and you get a new session on the second page.

Damien

Sep 21 '06 #5

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

Similar topics

9
3338
by: Larry Woods | last post by:
I have a site that works fine for days, then suddenly, I start getting ASP 0115 errors with an indication that session variables IN SEPARATE SESSIONS have disappeared! First, for background information, I have a customized 500-100 page that sends the value of various session variables via email to my support site. The situation: On the home page of the site, the FIRST THING that is done is a Session
1
3115
by: Ann Leland | last post by:
I have been using session variables to pass a user name from one ASP page to another inside framesets for 9 months and it stopped working this week. I have made no code changes but there was a "security update" installed on the server a few days ago but I can't find out exactly what it was. In the research I have done I found many articles on the subject of session variables in ASP pages inside framesets. From what I read a new...
1
737
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can find one? Thanks Werner P.S. Somehow I did not manage to do a followup in Googles newsgroups.
3
1346
by: Raghu Raman | last post by:
Hi, am in c#.net project. am using the session object for some logic. e-g:session="Add"; i can refer this by using if(Session=="Add") { logic
2
4918
by: Aryan | last post by:
Hi, I have put my session related parameter in web.config under system.web, given below is the code for same. <system.web> <sessionState timeout ="1440" mode ="InProc" /> </system.web> this session timeout is not working out, as this shows me login page again if i dont do something for more then 20 minutes.
25
6105
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I tried: <sessionState timeout="1"> </sessionState> bounced IIS, and after 1 minute still had a session. ??? -- thanks - dave
43
3440
by: davidkoree | last post by:
I mean not about cookie. Does it have something to do with operating system or browser plugin? I appreciate any help.
5
2211
by: Twayne | last post by:
Hi, If ever a newbie wants to know how much he has to learn yet, he only has to look here<g>!! ANYway: PHP 5.2.5; XP Pro SP2+, local Apache Server My actual question is: How do I get a POST variable into a session variable so I can use it in any other page I want to use it in? Apparently posted variables are only available in the Form page in
6
3785
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart editing processes place a very heavy load on the server as the effects of the edit ripple through the organisation structure, requiring potentially large numbers of rows in one of the tables to be updated. (I have done it this way to make the more...
0
9582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9157
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4301
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 we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.