Solved

Urgent Help Needed on Session.get_Item evaluated

Posted on 2004-09-27
1
445 Views
Last Modified: 2011-10-03
Dear all,

I having a problem here. The situation is as follow, I have a web system with is using C#, if error occur it will capture the error in Global.asax.cs in "Application_Error" and it will kept the error message in a session - Session["ErrorMsg"].

In Global.asax.cs it wil redirect to an error page - "ErrorPage.aspx" to display the error message reading from the session.

The problem is on "Page_Load" in "ErrorPage.aspx", it try to read the Session["ErrorMsg"] but it return error which is :- "function 'Session.get_Item' evaluated and returned null"

What is the problem that cause the error ? Would help if example is provided.

Thanks in advance.


Cheer,
yymae
0
Comment
Question by:yymae
1 Comment
 
LVL 1

Accepted Solution

by:
blueforce earned 50 total points
ID: 12165748
There could be a lot of causes for this.

The simplest solution to try first:

Immediately after setting the Session["ErrorMsg"] object, you should call Server.ClearError() in order to preserve Session state.

eg.

Session["ErrorMsg"] = Server.GetLastError.InnerException;
Server.ClearError();

Try that first, we can go from there.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question