Server.Transfer in control's Render event

J

jurev

In ASP.NET 2.0 I created a custom user control, in overriden Render
event I put Server.Transfer command. I put my control in aspx page. The
behavior is strange: expected behavior would be that the content of
transfered page should be displayed instead of my current aspx page.
But in this case, the content of transfered page is displayed inside
the aspx page where my user control was placed.

Question: what to do in user control Render event when I want the
parent aspx page to be transfered to another page?
 
J

jurev

Apparently this does the trick:

Instead of calling Server.Transfer in user control, call this:

Server.Execute(URL, Page.Response.Output);
Page.Response.End();

This will replace the whole aspx page that includes the user control
(instead of replacing only the user control content).
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top