Passing information between pages

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
 
C

Chris R. Timmons

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top