如何使用代码文件关闭asp.net网页。
问题描述:
大家好,
请帮助如何使用代码文件关闭asp.net网页。
hi all,
Please help how to close a asp.net webpage using code file.
答
System.Web.HttpContext.Current.Response.Write("<script>self.close();</script>");
或
or
Page.RegisterStartupScript("close", "<script>self.close();</script>");
添加了预标记[/ EDIT]
Added Pre Tag[/EDIT]
请在后面的代码中添加以下行:
Please add below line in your code behind:
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClosePage", "window.close();", true);
请尝试....
并抱歉prevoius soln。
Please try ....
and sorry for the prevoius soln.