You cannot do this with ASP.NET. ASP.NET on the server side can redirect the incoming request and cannot know about the parent frame.
But if you want to redirect the parent frame to some condition on the server side, you can call JavaScript from the server as follows:
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager.RegisterClientScriptBlock(this.GetType(), "RedirectScript", "window.parent.location = 'http://yoursite.com'", true); }
And of course, you can use simple JavaScript window.parent.location = 'http://yoursite.com' on the client side.
source share