Response.Redirect to Class that inherits from UI.Page?

妖精的绣舞 提交于 2019-12-06 08:18:45

Try just doing this instead:

HttpContext.Current.Response.Redirect("...");

No, as there is no current overload that accepts a UI.Page instance. However, you could call the Render method on your new page and write directly to the response stream. AKA

  1. Clear the Response Buffer.
  2. Render your page instance to the response buffer.
  3. Invoke Response.End() to flush the request and send it to the client.

If your new page doesnt actually do anything, you can additional just send no content back with the response.

You can use Server.Transfer and pass in the instance of the page object that you want to tranfer to.

Here is the documentation: HttpServerUtility.Transfer

BabyAngel
 HttpRequest Request = HttpContext.Current.Request;
 HttpResponse Response = HttpContext.Current.Response; 

And after that you can redirect any page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!