Problem is not because of the masterpage
The code writes to output instructions for browser to show alert message. But this output will never be sent to the client, because next line instructs your web application to send this client response with code 302 and address to which the user must be redirected instead.
You should use Javascript to perform redirect from the client. The code would look like this:
Response.Write("<script>alert('my message'); ");
Response.Write("window.location='[new address]'</script>");