i tried to close the modal dialog in sandbox solution using the following code

```
        HttpContext context = HttpContext.Current;
        context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>");
        context.Response.Flush();
        context.Response.End();

```

but its throwing null value error at

**context.Response.End();**

this works fine in farm solutions but not work sandbox solution.

is there any way to close modal dialog in sandbox solutions?

Thanks in advance