Hi,

How can I force the tempory report file for a Crystal Report to be written
in the folder I want.

I tried it to do it in the constructor of the report class. It's ignored.

Public Sub New()
MyBase.New()

Dim tempPath As String = "\\myServer\myDirectory\" &
System.Security.Principal.WindowsIdentity.GetCurrent().Name.Substring(System.Security.Principal.WindowsIdentity.GetCurrent().Name.IndexOf("\")
+ 1).ToUpper() & "\Temp\"
If System.IO.Directory.Exists(tempPath) = False Then
System.IO.Directory.CreateDirectory(tempPath)
End If
Dim tempFileName As String = System.Guid.NewGuid().ToString.ToLower
& ".rpt"
m_sTempFilename = tempPath & tempFileName

End Sub

I tried to do it on the moment the report is assigned as reportsource to a
reportviewer in a dialogform. Gives an error "Report can not be loaded", but
loads it anyway and ignores the given path.

Private Sub dlgReport_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim oReport As Reports.MyReport = CType(crViewer.ReportSource,
Reports.MyReport)
Dim tempPath As String = "\\myServer\myDirectory\" &
System.Security.Principal.WindowsIdentity.GetCurrent().Name.Substring(System.Security.Principal.WindowsIdentity.GetCurrent().Name.IndexOf("\")
+ 1).ToUpper() & "\Temp\"
If System.IO.Directory.Exists(tempPath) = False Then
System.IO.Directory.CreateDirectory(tempPath)
End If
Dim tempFileName As String = System.Guid.NewGuid().ToString.ToLower
& ".rpt"
oReport.FileName = tempPath & tempFileName
crViewer.RefreshReport()
End Sub

The real problem is that my code runs correctly on my PC, but on the Citrix
server where it is published, it gives this error:

The connection can not be made
temp_36cf1a26-ad41-472c-9d2d-690e525bd94c
{81FF3D89-BF38-40A6-BCA2-B1AAD5350C15}.rpt

As the connection string to the database is correct, and all other ADO.NET
related code works, it could only be a security problem on the moment the
tempory file is made. In other words the program on the Citrix server does
not have the permission to write the tempory report file.
I tried to find out where the tempory report is written by trying to give a
message at run time:



Dim oReport As Reports.MyReport = CType(crViewer.ReportSource,
Reports.MyReport)
MessageBox.Show(oReport .FileName)

Only results in an empty string.

In Debug mode I get the same. But when I ask for the QuickWatch for the
oReport object, after some secondes the real FileName is given and after that
the MessageBox.Show(oReport .FileName) command gives me also the correct
result.

Unfortunatly I can't debug on the Citrix server. And as such I can't find
the tempory file name.

Can anybody help me in this.

I'm using Studio.NET 2008, SQL Server 2005 and Crystal Reports 12


Thanks,

--
RW