q; not performed during debug

G

Guest

private void DownloadPDF(string fPath)
{
Response.Clear();
Response.ContentType = "Application/pdf";
Response.WriteFile(fPath);
Response.End();
}


private void Show(string file)
{
DownloadPDF(file);

int i =1; // not performed during debug
i=i+1;
}

While I am debugging the code above I noticed the breakpoint on i=i+1 is
never hit. What is problem and how I can resole this? After downloading the
file I need to perform some operations and display something on the user
interface.
 
M

Marina Levit [MVP]

You are calling Response.End in DownloadPDF. That ends the current request.
Those 2 lines of code should never be run - both in debug and release. So
everything is behaving as expected given the code you are running.
 
B

bruce barker \(sqlwork.com\)

Response.End() causes an immdediate exit (by killing the current thread)
don't call it until you've done you additional work.

-- bruce (sqlwork.com)
 
G

Guest

Ok. Thanks for the reply. I am doing this.MyLabel.Text=â€Testâ€; just before
Response.End() and this does not have impact on the screen. What is problem
there?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top