C# 我没有得到重定向,而是得到:无法计算表达式,因为代码已优化或本机帧位于调用堆栈顶部
我有一个对话框,我需要提交,使它消失,然后重定向,否则重定向将发生在对话框内 我有以下方法不再有效:C# 我没有得到重定向,而是得到:无法计算表达式,因为代码已优化或本机帧位于调用堆栈顶部,c#,asp.net,exception,redirect,C#,Asp.net,Exception,Redirect,我有一个对话框,我需要提交,使它消失,然后重定向,否则重定向将发生在对话框内 我有以下方法不再有效: private void CommitPopupAndRedirect(string url) { var script = string.Format("<script type='text/javascript'>parent.window.location='{0}';window.frameElement.commitPopup();</script>",
private void CommitPopupAndRedirect(string url)
{
var script = string.Format("<script type='text/javascript'>parent.window.location='{0}';window.frameElement.commitPopup();</script>", url);
Context.Response.Write(script);
Context.Response.Flush();
Context.Response.End();
}
但它仍然不起作用
非常感谢任何帮助 您需要使用
RegisterStartupScript
有关详细信息,请查看:
或者我的回答解决了你的问题吗?
HttpContext.Current.ApplicationInstance.CompleteRequest();