T
teddysnips
My clients get the following exception message when they try to write
to a file:
<exception>
Server Error in '/MyApp' Application.
Bad file name or number.
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.IO.IOException: Bad file name or number.
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:
[IOException: Bad file name or number.]
Microsoft.VisualBasic.FileSystem.Write(Int32 FileNumber, Object[]
Output) +82
MyApp.PrinterSelectionForm.PrintMyReport() +1241
</exception>
The code that throws this exception (much simplifed) is:
Public Sub PrintMyReport()
Dim rpt As New
CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim ds As New DataSet()
Dim rptName As String
Dim intFileNumber As Integer = FreeFile()
Try
' A whole bunch of code to print a report using Crystal Reports.
' Crystal throws an exception
Catch ex As Exception
'problem
FileOpen(intFileNumber, "C:\My_Debug\MyAPP_ERRORS.txt",
OpenMode.Append)
Write(intFileNumber, "Number: " & ex.Source & " Message: " &
ex.Message & " Stack Trace: " & ex.StackTrace & vbNewLine)
Finally
FileClose(intFileNumber)
End Try
End Sub
This problem has only just started happening - the application has
been in use since 2004.
My first thought was that the permissions on C:\My_Debug
\MyAPP_ERRORS.txt weren't correct. However, the file had been written
to as recently as ten days ago (when a completely different problem
happened). I asked the SysAdmin to double-check the permissions on
the folder and file, and he says they're fine.
So, if it's NOT a permissions problem, what else can it be?
Help!
Thanks
Edward
to a file:
<exception>
Server Error in '/MyApp' Application.
Bad file name or number.
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.IO.IOException: Bad file name or number.
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:
[IOException: Bad file name or number.]
Microsoft.VisualBasic.FileSystem.Write(Int32 FileNumber, Object[]
Output) +82
MyApp.PrinterSelectionForm.PrintMyReport() +1241
</exception>
The code that throws this exception (much simplifed) is:
Public Sub PrintMyReport()
Dim rpt As New
CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim ds As New DataSet()
Dim rptName As String
Dim intFileNumber As Integer = FreeFile()
Try
' A whole bunch of code to print a report using Crystal Reports.
' Crystal throws an exception
Catch ex As Exception
'problem
FileOpen(intFileNumber, "C:\My_Debug\MyAPP_ERRORS.txt",
OpenMode.Append)
Write(intFileNumber, "Number: " & ex.Source & " Message: " &
ex.Message & " Stack Trace: " & ex.StackTrace & vbNewLine)
Finally
FileClose(intFileNumber)
End Try
End Sub
This problem has only just started happening - the application has
been in use since 2004.
My first thought was that the permissions on C:\My_Debug
\MyAPP_ERRORS.txt weren't correct. However, the file had been written
to as recently as ten days ago (when a completely different problem
happened). I asked the SysAdmin to double-check the permissions on
the folder and file, and he says they're fine.
So, if it's NOT a permissions problem, what else can it be?
Help!
Thanks
Edward