Accessing masterpage properties from server.transfer page?

Discussion in 'ASP .Net' started by evantay, May 26, 2007.

  1. evantay

    evantay Guest

    I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties
    from my master pages within a page that inherits from that master page (a
    child page). However the values are always null.

    In my masterpage I have this:

    private bool m_AlreadyTested;
    public bool AlreadyTested
    {
    get { return m_AlreadyTested; }
    set { m_AlreadyTested = value; }
    }

    Then within the Page_Load of the master page I am doing this:

    if certainConditions == true then
    AlreadyTested = true;
    Server.Transfer("/error.aspx");
    end if

    Then in error.aspx child page (derrived from the master page) I do this from
    its Page_Load event:
    Response.Write(Master.AlreadyTested.toString());

    However the AlreadyTested always displays as FALSE, even though itis hard
    coded to True. When I step through in the debugger I can see it is set to
    True just prior to the Server.Transfer. But once it gets into the transfered
    page everything is nulled out and bools are set to False.

    Similarly I have other properties I've set to valid object instances prior
    to the .Transfer and afterward those are all Null too.

    What is going on here? I thought under ASP.NET 2.0 I could tap into the
    master page properties even from exceution of the .Transfer pages?

    Thanks!
     
    evantay, May 26, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    MasterPage -> Page -> MasterPage Code Access

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Apr 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    7,925
    Steven Cheng[MSFT]
    Apr 14, 2006
  2. evantay
    Replies:
    4
    Views:
    768
    Walter Wang [MSFT]
    May 30, 2007
  3. Rick
    Replies:
    8
    Views:
    2,748
    Jialiang Ge [MSFT]
    Aug 16, 2007
  4. Replies:
    2
    Views:
    615
  5. Jim
    Replies:
    1
    Views:
    954
    Aaron Bertrand - MVP
    Jan 28, 2004
Loading...

Share This Page