无法关闭当前窗口

时间:2014-02-13 07:31:23

标签: c# asp.net

我无法使用C#代码关闭当前的asp.net页面。我试过了:

ClientScript.RegisterClientScriptBlock(Page.GetType(), 
                                       "script", 
                                       "window.close();", 
                                       true);

我没有收到任何错误,但它无法正常工作。

2 个答案:

答案 0 :(得分:1)

请尝试以下链接

Programmatically close aspx page from code behind

根据情景可能非常。请阅读以上主题回复

以下链接也显示相同的问题

How to close the current tab in the server side button click?

答案 1 :(得分:1)

试试这个

ClientScript.RegisterStartupScript(typeof(Page), 
   "closePage", 
   "window.close();",
    true);