ASP.NET PDF export problem on precompiled web site

BoskoBosko Belgrade, Serbia
edited 2:35AM in FastReport .NET
Hi,
I am having a problem printing to PDF from ASP.NET web site, but only after compilation and publishing the web site to remote server.
If a web site is not compiled, everything is working fine, but after compilation a get following error
Server Error in '/' Application.
--------------------------------------------------------------------------------

The file '/Print.aspx' has not been pre-compiled, and cannot be requested. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The file '/Print.aspx' has not been pre-compiled, and cannot be requested.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[HttpException (0x80004005): The file '/Print.aspx' has not been pre-compiled, and cannot be requested.]
   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +8759758
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
   System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
   System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3614

Web site is compiled and published in WS 2008 using "Build/Publish web site" tool, and everything else is working as it suppose to work, only this is where I got the exception.

The code I am using to generate PDF to download stream is from exaple application from FastReport
        // No temp files
        FastReport.Utils.Config.WebMode = true;

        // Set PDF export props
        FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
        pdfExport.ShowProgress = false;
        pdfExport.Subject = "Subject";
        pdfExport.Title = "xxxxxxx";
        pdfExport.Compressed = true;
        pdfExport.AllowPrint = true;
        pdfExport.EmbeddingFonts = true;

        // Load our report
        FastReport.Report report = new FastReport.Report();

        FastReport.EnvironmentSettings evn = new FastReport.EnvironmentSettings();
        evn.DatabaseLogin += new FastReport.DatabaseLoginEventHandler(evn_DatabaseLogin);

        report.Load(Request.PhysicalApplicationPath + "Templates\\Invoice\\"+Request.QueryString["report"]+".frx");
        report.SetParameterValue("ID", 123));
        
        report.Prepare();

        // Export report to PDF stream
        MemoryStream strm = new MemoryStream();
        report.Export(pdfExport, strm);
        report.Dispose();
        pdfExport.Dispose();

        // Stream the PDF back to the client as an attachment
        Response.ClearContent();
        Response.ClearHeaders();
        Response.Buffer = true;
        Response.ContentType = "Application/PDF";
        Response.AddHeader("Content-Disposition", "attachment;filename=some_filename.pdf");

        strm.Position = 0;
        strm.WriteTo(Response.OutputStream);
        strm.Dispose();

        Response.End();

All dependent files are in Bin directory of my application, but I just cant make it work.

Any ideas?

Thanks in advance.

Comments

  • BoskoBosko Belgrade, Serbia
    edited 2:35AM
    I am sorry, this is nothing to do with FastReport.

    It was some strange issue with asp.net and web site compilation.

    I deleted all files from web server, published and uploaded the entire site again, and it is working now.

    It was just coincidence that my web site "stucked" with a page that includes FastReport.

    My mistake, sorry! >

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.