First in the web.config I have <customErrors mode="Off" />
If I comment in the catch and only leave the response.write("ERROR"),
then it's displayed.
If I remove the Throw (the one with a comment in the code) in the
catch, it's the same thing.
It seems that if I make a fileCopy with wrong file name, the page is
not displayed. here's my web page :
Imports AFTypeFactory
Imports System.IO
Imports DistillInterface
Public Class RegenerationProgressionTrt
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ImgPhase1 As System.Web.UI.WebControls.Image
Protected WithEvents lblPhase1 As System.Web.UI.WebControls.Label
Protected WithEvents ImgPhase2 As System.Web.UI.WebControls.Image
Protected WithEvents LblPhase2 As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Request("PS") = 1 Then
lblPhase1.Text = "Phase 1 - PS"
If Request("PDF") = 1 Then
LblPhase2.Text = "Phase 2 - PDF"
Else
LblPhase2.Visible = False
End If
Else
If Request("PDF") = 1 Then
lblPhase1.Text = "Phase 1 - PDF"
LblPhase2.Visible = False
End If
End If
Try
traitements()
Catch ex As Exception
End Try
End Sub
Private Sub traitements()
Dim odsDossier As OffDocDossier = Session("Dossier")
If Request("PS") = 1 Then
Try ' phase 1 - PS
Dim FicDOC As String() =
DBActions.GetUploadById(odsDossier.DocFileId)
Dim FicPS As String() =
DBActions.GetUploadById(odsDossier.PsFileId)
Dim newPerson As New Impersonate.ImpersonateUser
Dim isValid As Boolean = newPerson.Start()
If File.Exists(Application("TempFolder") & FicDOC(4))
Then ' <----- HERE if the file cannot be accessed, there's anj
exception. It's thrown as I can see in the debugger
File.Delete(Application("TempFolder") & FicDOC(4))
End If
File.Copy(FicDOC(1) & FicDOC(4),
Application("TempFolder") & FicDOC(4))
If isValid Then
newPerson.End()
End If
WordPilot.PrintWordDoc(Application("TempFolder") &
FicDOC(4), Application("TempFolder") & FicPS(4))
isValid = newPerson.Start()
If File.Exists(FicPS(1) & FicPS(4)) Then
File.Delete(FicPS(1) & FicPS(4))
End If
File.Copy(Application("TempFolder") & FicPS(4),
FicPS(1) & FicPS(4))
If isValid Then
newPerson.End()
End If
ImgPhase1.Visible = True
Catch ex As Exception
lblPhase1.Font.Bold = True
lblPhase1.ForeColor = Color.Red
Throw ' If I remove this line, there's the same
blank screen...
End Try
If Request("PDF") = 1 Then
Try ' phase 2 - PDF
GenererPdf(odsDossier)
ImgPhase2.Visible = True
Catch ex As Exception
LblPhase2.Font.Bold = True
LblPhase2.ForeColor = Color.Red
Throw
End Try
End If
Else
If Request("PDF") = 1 Then
Try ' phase 1 - Génération du .PDF
GenererPdf(odsDossier)
ImgPhase1.Visible = True
Catch ex As Exception
lblPhase1.Font.Bold = True
lblPhase1.ForeColor = Color.Red
Throw
End Try
End If
End If
End Sub
Private Sub GenererPdf(ByVal CurrDossier As OffDocDossier)
If CurrDossier.WordPageCount <
Application("NbPagesMaxShortDistiller") Then
DBActions.InsertTask(CurrDossier.Id,
AFTypeFactory.enService.ShortDistiller)
Dim distiller As IDistillFactory =
CType(Activator.GetObject(GetType(IDistillFactory),
Application("AFDistillServiceUrl")), IDistillFactory)
distiller.Wakeup()
Else
DBActions.InsertTask(CurrDossier.Id,
AFTypeFactory.enService.LongDistiller)
Dim distiller As IDistillFactory =
CType(Activator.GetObject(GetType(IDistillFactory),
Application("AFLongDistillServiceUrl")), IDistillFactory)
distiller.Wakeup()
End If
End Sub
End Class