I have developed a web application in ASP.Net 2.0. I am preparing a report and am trying to know publish it and open it on screen for the user to view it. I am using the following lines (r is my report)
try
{
r.Publish(
"c:\\Report", FileFormat.PDF);
System.Diagnostics.
Process.Start("Report.pdf");
}
catch (Exception ex)
throw(new Exception("Cannot produce report: " + ex.Message));
While this works fine on my development machine (I get Acrobat to open and view the PDF file), when deployed on the server the PDF file is created but the application is not started for the user to view the document. Furthermore, no exception is captured in the above code.
Can anyone help please?
Thanks
Chris
Never mind on this issue; it turned out to be something else. Thanks.
Hi again
I have now tried to open the Acrobat Reader application of the client using the code above but I get an error thrown:
A potentially dangerous Request.Form value was detected from the client
Do you know why this happens? Again, I do not get this when I run the project from VS2008 on my machine; only on IIS.
Yep that worked
'trigger a full postback so Response.xxxxx can be performed
ScriptManager1.RegisterPostBackControl(btnPrintOrders)
You should have the server call be made through a full-page postback, rather than an AJAX callback handled by the UpdatePanel (or by our WebAsyncRefreshPanel).
Since your response will itself be a PDF file, rather than a regular HTML postback response (or AJAX-related XML), it shouldn't cause an actual refresh of your page.
Now how should this method be modified when using an Ajax UpdatePanel since the Response.Writes will not work?