Redirect Whole Page In CodeBehind With Response.Write Method

Sometimes I need to redirect whole page from codebehind. This can be done with the following code:

//It does redirects in WordPress too if I don't uncomment the code...
Response.Write("<script type='text/javascript'>//window.top.location.href = 'Default.aspx';</script>");