Response.Write and Response.redirect not be used simultaneously

As shown, I am implementing a delete operation, hope to achieve refresh the page after the "deleted successfully" in pop, but found Response Write down the Redirect can not occur simultaneously, as long as there Response.Redirect ( "Default5.aspx"); statement appears, will "delete success" does not popups appear.

 

The reason is: Response.Write is to output content to the front desk , but Response.Redirect is in the background jump, so when used together, can not see Response.Write effect, and jump straight up.

 

Solution:

Using Response.Write ( "<script> alert ( 'successfully deleted!'); Window.location.href = 'Default5.aspx'; </ script>"); achieved.

 

Reference: https://bbs.csdn.net/topics/100074010

Guess you like

Origin www.cnblogs.com/donelyorjune/p/12632212.html