I had the same question, and Michael Kennedy's answer was exactly what I needed! Since I am using MVC 2, I had to change the syntax. I will put it here as a link to others.
In view:
<% if ((bool)ViewData["ShouldClose"]) { %>
<script type="text/javascript">
window.close();
</script>
<% } %>
In the controller:
ViewData["ShouldClose"] = true;
Remember to set the ViewData in each call for the view, otherwise you will get a NullReference for the cast for bool.
source
share