Click here to Skip to main content
15,895,483 members
Home / Discussions / C#
   

C#

 
GeneralRe: Please can someone do me a favour and run a C# test for me Pin
OriginalGriff13-Feb-11 6:09
mveOriginalGriff13-Feb-11 6:09 
GeneralRe: Please can someone do me a favour and run a C# test for me Pin
Richard MacCutchan13-Feb-11 6:24
mveRichard MacCutchan13-Feb-11 6:24 
GeneralRe: Please can someone do me a favour and run a C# test for me Pin
PIEBALDconsult13-Feb-11 14:58
mvePIEBALDconsult13-Feb-11 14:58 
AnswerRe: Please can someone do me a favour and run a C# test for me Pin
Dave Kreskowiak13-Feb-11 10:59
mveDave Kreskowiak13-Feb-11 10:59 
GeneralRe: Please can someone do me a favour and run a C# test for me Pin
Dave Midgley13-Feb-11 20:19
Dave Midgley13-Feb-11 20:19 
QuestionVariable to be Accessed throughout code [modified] Pin
MWRivera12-Feb-11 16:37
MWRivera12-Feb-11 16:37 
AnswerRe: Variable to be Accessed throughout code Pin
OriginalGriff12-Feb-11 21:21
mveOriginalGriff12-Feb-11 21:21 
GeneralRe: Variable to be Accessed throughout code Pin
MWRivera13-Feb-11 4:07
MWRivera13-Feb-11 4:07 
Thank you for your reply.
The timeout is stored in the web.config file, this is where the value is being retrieved from. I need to use this value in my code on multiple pages within the web application.

I am trying to add the value to a session variable within the default.aspx.cs file and then trying to retrieve it from the session variable in another but keep getting the error:

"Object reference not set to an instance of an object."

This indicates to me that the session variable is null, but how can this be when I previously populated it in the default page?

Here is some basic code I put together to make it simpler for testing:

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session.Add("Test", "Testing session pass");
    }
}


public partial class FormPage : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {        
        Response.Write(Session["Test"].ToString());            //<-- Get error on this line
    }
}


Do you know what the problem is?

Thank you
GeneralRe: Variable to be Accessed throughout code Pin
OriginalGriff13-Feb-11 5:42
mveOriginalGriff13-Feb-11 5:42 
GeneralRe: Variable to be Accessed throughout code Pin
MWRivera14-Feb-11 15:31
MWRivera14-Feb-11 15:31 
AnswerRe: Variable to be Accessed throughout code Pin
RichardGrimmer15-Feb-11 3:55
RichardGrimmer15-Feb-11 3:55 
GeneralRe: Variable to be Accessed throughout code Pin
MWRivera15-Feb-11 4:03
MWRivera15-Feb-11 4:03 
QuestionSimple calculator Pin
nstk12-Feb-11 7:28
nstk12-Feb-11 7:28 
AnswerRe: Simple calculator PinPopular
Luc Pattyn12-Feb-11 7:37
sitebuilderLuc Pattyn12-Feb-11 7:37 
GeneralRe: Simple calculator Pin
nstk12-Feb-11 11:07
nstk12-Feb-11 11:07 
AnswerRe: Simple calculator Pin
Manfred Rudolf Bihy12-Feb-11 11:19
professionalManfred Rudolf Bihy12-Feb-11 11:19 
AnswerRe: Simple calculator Pin
Luc Pattyn12-Feb-11 11:21
sitebuilderLuc Pattyn12-Feb-11 11:21 
GeneralRe: Simple calculator Pin
nstk13-Feb-11 23:57
nstk13-Feb-11 23:57 
GeneralRe: Simple calculator [modified] Pin
nstk14-Feb-11 3:52
nstk14-Feb-11 3:52 
AnswerRe: Simple calculator Pin
DaveyM6912-Feb-11 12:22
professionalDaveyM6912-Feb-11 12:22 
AnswerRe: Simple calculator Pin
Luc Pattyn12-Feb-11 18:04
sitebuilderLuc Pattyn12-Feb-11 18:04 
GeneralRe: Simple calculator Pin
DaveyM6913-Feb-11 2:48
professionalDaveyM6913-Feb-11 2:48 
AnswerRe: Simple calculator Pin
Luc Pattyn13-Feb-11 3:01
sitebuilderLuc Pattyn13-Feb-11 3:01 
GeneralRe: Simple calculator [modified] Pin
nstk14-Feb-11 10:21
nstk14-Feb-11 10:21 
AnswerRe: Simple calculator Pin
RichardGrimmer15-Feb-11 3:58
RichardGrimmer15-Feb-11 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.