Passing information between pages

  • Thread starter Thread starter John
  • Start date Start date
J

John

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
 
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.
 
Back
Top