3

i have asp.net page that is opened inside an iframe. How to redirect to exceptionmessage.aspx page if any error occurs? Currently the page redirected is displayed inside the iframe. I want to close the iframe and redirect to exceptionmessage page.

1 Answer 1

3

you can use this by placing your code snippet in try catch block

if your code gets some error than in your catch block call a js function in that redirect to your error page.

try
{
//your code
}
catch
{
Page.RegisterStartupScript("RefreshParent","<script language='javascript'>RefreshParent()</script>"); 
}

<script language="javascript">
function RefreshParent()
{
window.parent.location.href = "myErrorPage.aspx";
}
</script>

you can do some thing like this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.