Re: Accessing variables

From: David S (
Date: 12/04/02

From: "David S" <>
Date: Wed, 4 Dec 2002 11:13:46 -0700

If you are using Server.Transfer or Server.Execute to control the
first.aspx->second.aspx->third.aspx flow, you can use the Context property.
To write a value to it from your first page:

Context.Items("someKey") = <someValue>

You can then read the value from your third page by referring to
Context.Items("someKey"), converting it to the specific data type as

If the flow from first.aspx->second.aspx->third.aspx happens any other way,
I think the Session property is probably your best bet. Its use is very
similar to that of Context. I hope that helps you.

"krishna c kanthety" <> wrote in message
> Hi All,
> i am trying to access the values in the variables that are defined in my
> start page, from a third page..
> first.aspx->second.aspx->third.aspx
> now i am trying to access the values  in first.aspx into third.aspx
> directly..i used the following code.
> fp1 = CType(context.Handler, first)..but its givin me a null object
> reference error..any ideas???
> thanks in advance..KC

Relevant Pages

  • Re: Why is this.Page NOT initialized when a composite controls CreateChildControls is being executed
    ... Get reference to System.Web.HttpContext.Current.Handler (or just straight ... via Control's Context property) ... >> Can you determine at which exact stage your CreateChildControls gets ... Page property is set to a Control at Init ...
  • Re: Call Page from Control
    ... a custom control cannot again contain a page. ... Basically a control sits on the page and its not the other way around. ... U can add images as embedded resource to the control and you can read the ... >> you have there (and also all you have via Context property which ...
  • Re: Call Page from Control
    ... Control knows only about its containing Page via its Page property. ... have there (and also all you have via Context property which represents ... current HttpContext) is what you can use unless you hardcode the control ... Prev by Date: ...