<p>The following code is implemented in Page_Load event to show SaveFileDialog to the user</p>

<pre><code>string targetFileName = Request.PhysicalApplicationPath + "Reports\\TempReports\\FolderMasters" + Utility.GetRandomNumber() + ".pdf";

FileInfo file = new FileInfo(targetFileName);
// Clear the content of the response.
Response.ClearContent();

Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/pdf";
Response.TransmitFile(file.FullName);
Response.End();
</code></pre>

<p>How can I get the user response to SaveFileDialog, as I need to know user response to this dialog?</p>

<p>Also, is there something wrong with these lines of code, as I had the following exception</p>

<p>"Unable to evaluate expression because the code is optimized or a native frame is on   top of the call stack."</p>

I'm here again, as I got a solution for my second question.
For
```
Response.End
```
, call the
```
HttpContext.Current.ApplicationInstance.CompleteRequest
```
method instead of Response.End to bypass the code execution to the Application_EndRequest event.
Have look ...