473,230 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Page not displaying when exception raised

I have a little problem.

I designed a webpage (VB.Net) with code behind "Page_Load".

If the process works fine, the page is shown.

If the process raises an exception, I catch it and modify a label
inside the page (red color, ...)
But, the page is not displayed. I only have a blank screen.
No error page, no nothing.. just stops.

Do you know this problem ? The solution ?

Thanks

Patrick

Nov 19 '05 #1
5 1238
Try pasting some snippet and where get the error.
Patrick

<pb******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a little problem.

I designed a webpage (VB.Net) with code behind "Page_Load".

If the process works fine, the page is shown.

If the process raises an exception, I catch it and modify a label
inside the page (red color, ...)
But, the page is not displayed. I only have a blank screen.
No error page, no nothing.. just stops.

Do you know this problem ? The solution ?

Thanks

Patrick

Nov 19 '05 #2
ypu may want to check the view source of the HTML page appearing blank..
any javascript error or any broken tags?

"pb******@gmail.com" wrote:
I have a little problem.

I designed a webpage (VB.Net) with code behind "Page_Load".

If the process works fine, the page is shown.

If the process raises an exception, I catch it and modify a label
inside the page (red color, ...)
But, the page is not displayed. I only have a blank screen.
No error page, no nothing.. just stops.

Do you know this problem ? The solution ?

Thanks

Patrick

Nov 19 '05 #3
No, the page contains the <html><head><body> ... </html>
The generated page is ok but empty.
I'm handling files (file.move, file.delete), when I was working on dos
programs (long time ago), there were specific problems when working on
files. Maybe it's a recurrent problem ?

Nov 19 '05 #4
try posting the part of the code that generate error..

possibly there is an error in the exception handler(?).. you may want to
try commenting every thing in side the catch {} and keep a simple
"Response.Write("error")) ...

Also how is the customErrors configureed in web.config ?

<customErrors
mode="RemoteOnly"
/>

"pb******@gmail.com" wrote:
No, the page contains the <html><head><body> ... </html>
The generated page is ok but empty.
I'm handling files (file.move, file.delete), when I was working on dos
programs (long time ago), there were specific problems when working on
files. Maybe it's a recurrent problem ?

Nov 19 '05 #5
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

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
4
by: Tony | last post by:
I am in the process of setting up a base page model for multiple reasons. One of the reasons is so that I can catch all exceptions when derived pages throw/raise them. I don't want to use the...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
2
by: wawork | last post by:
Fairly new to python. In a try except how do you display the true (raw) error message so it can be displayed back to the user?
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
4
by: Kuldeep | last post by:
Hi All, I am trying to read the contents of a page through its URL. My code snippet is as follows: public void mtdGetPageDataHWR() { HttpWebRequest objRequ =...
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
5
by: =?Utf-8?B?c3VydHVyeg==?= | last post by:
Hi, I feel like a noob for asking this. When I publish a VB windows application, I want to disable the ability of the the user to continue when there is an unhandled exception. For example,...
2
by: dm3281 | last post by:
Hi all -- I have a strange issue. I have obtained a scripted database and compiled ASP.NET 2.0 application from a sister site that I'm trying to implement locally. I have successfully...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.