Passing information between pages

Discussion in 'ASP .Net' started by John, Apr 15, 2006.

  1. John

    John Guest

    Hi

    I have on my page1.aspx the following;

    Context.Items("Msg1") = msgstr
    Response.Redirect("Page2.aspx")

    Page2.aspx has the following;

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Handles Me.Load
    lblMsg.Text = CType(Context.Items("Msg1"), String)
    End Sub

    The Context.Items("Msg1") does not seem to be getting to page2.aspx however.
    What am I missing?

    Thanks

    Regards
    John, Apr 15, 2006
    #1
    1. Advertising

  2. "John" <> wrote in
    news:#:

    > Hi
    >
    > I have on my page1.aspx the following;
    >
    > Context.Items("Msg1") = msgstr
    > Response.Redirect("Page2.aspx")
    >
    > Page2.aspx has the following;
    >
    > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Me.Load
    > lblMsg.Text = CType(Context.Items("Msg1"), String)
    > End Sub
    >
    > The Context.Items("Msg1") does not seem to be getting to
    > page2.aspx however. What am I missing?


    John,

    Use Server.Transfer instead of Response.Redirect if you want to
    transfer the content of Context.Items between pages.

    Response.Redirect sends a response to the client browser telling it
    to request the given page. Server.Transfer keeps all processing on
    the server - it stops the processing of the current page and starts
    processing the given page.

    --
    Hope this helps.

    Chris.
    -------------
    C.R. Timmons Consulting, Inc.
    http://www.crtimmonsinc.com/
    Chris R. Timmons, Apr 15, 2006
    #2
    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. Munsifali Rashid
    Replies:
    0
    Views:
    435
    Munsifali Rashid
    Jun 27, 2003
  2. S. Justin Gengo

    Re: Sharing information between pages

    S. Justin Gengo, Aug 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    350
    S. Justin Gengo
    Aug 18, 2003
  3. francois

    passing information between ASPX pages

    francois, Jan 9, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    493
    RAMADU
    Jan 12, 2004
  4. francois

    passing information between pages

    francois, Feb 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    362
    Michael Ramey
    Feb 3, 2004
  5. Tim Almond

    Passing information between pages

    Tim Almond, Jul 18, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    119
    Tim Almond
    Jul 18, 2003
Loading...

Share This Page