HTMLExport and UnauthorizedAccessException
There is html export from report on my website. When I try to call method Export, an UnauthorizedAccessException is thrown.
This is snapshot of my code:
Detail of the exception:
System.UnauthorizedAccessException: Access to the path 'html.files\' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj)
at System.IO.Directory.CreateDirectory(String path)
at FastReport.Export.Html.HTMLExport.Start()
at FastReport.Export.ExportBase.Export(Report report, Stream stream)
at FastReport.Report.Export(ExportBase export, Stream stream)
Could you help me?
Thx
This is snapshot of my code:
FastReport.Utils.Config.WebMode = true;
Stream report = ....
FastReport.Report freport = new FastReport.Report();
freport.Load(report);
freport.Prepare();
ExportBase exporter = new FastReport.Export.Html.HTMLExport();
System.IO.MemoryStream result = new System.IO.MemoryStream();
freport.Export(exporter, result);Â Â Â Â
freport.Dispose();
Detail of the exception:
System.UnauthorizedAccessException: Access to the path 'html.files\' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj)
at System.IO.Directory.CreateDirectory(String path)
at FastReport.Export.Html.HTMLExport.Start()
at FastReport.Export.ExportBase.Export(Report report, Stream stream)
at FastReport.Report.Export(ExportBase export, Stream stream)
Could you help me?
Thx
Comments
It's not possible to export to stream with HTML export because it produces many files (.css, pictures, .html for each page). You may use MHT export instead, it produces single file and can be exported to a stream.