Click here to Skip to main content
15,886,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to redirect from a page which contains an iframe. and from this iframe some error occured and i am capturing it in global.asax page to set a default Error.aspx Page.


It redirects inside the iframe. Please anybody have suggestions
Thanks in advance.
Posted
Updated 10-Aug-16 15:25pm

C#
Response.Write("<script language='javascript'>self.parent.location='login.aspx';</script>")
 
Share this answer
 
Yes you can handle as following

By having the following javascript/jQuery code within the custom error page head section, it will check whether it's loading inside an iframe. If it's loading inside an iframe, then the custom error page will set as the top page.
XML
<script>

    $(function () {

        if (window != window.top) { //Checks whether the custom error page is loading inside an iframe

            window.top.location = window.location; //Set the top location to custom error page location

        }

    });

</script>
 
Share this answer
 
Comments
Kailash Polai 12-Dec-14 5:20am    
Thanks a lot Biij for your quick response. I will check this coding at my side. it looks like it can solve my problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900