Monday, April 04, 2005 9:39 AM
by
rjdudley
"Login Failed" when exporting from Crystal Reports .NET
If you try to export to PDF or XLS from a Crystal Reports .NET report, and you receive “Login Failed” error, the problem is usually your export path. The ASPNET user typically does not have the proper permissions to access directories outside of the web application. Change your export path from
objDiskOpt.DiskFileName = “C:\export.pdf“
to
objDiskOpt.DiskFileName = Server.MapPath(".") & "/export/" & strExportFile
This will export your report to a subdirectory of the web application. Make sure ASPNET has Modify permissions on the subdirectory, and make sure to protect PDFs if you are using Forms Authentication.
If you absolutely, positively have to put your reports outside of your web app, you can grant ASPNET Modify permissions on the target directory, but this can open security issues as well. If your export directory is in your web application and you still receive this error, check that ASPNET user has NTFS MODIFY permissions on the export directory.
<edit 2004-09-21>
ASPNET is the default user account on Win2K servers if you have not enabled impersonation. On Win2K3, the account is NetworkService if you have not enabled impersonation. If you have enabled impersonation, the impersonated user account (and not ASPNET or NetworkService) needs MODIFY permission on the export directory.
</edit>
Crystal Reports .NET Programming
If you're new to Crystal Reports, or just to CR .NET, this is the book you need. Part how-to, part programming reference, lots of simple examples in both C# and VB.NET.