473,608 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

display exception one label problem

Hi everyone,
I have a piece of code in sales.aspx.vb like this:
Protected WithEvents Message As System.Web.UI.W ebControls.Labe l
Try
...
ChartImage.Imag eUrl = "ChartGenerator .aspx?" + DataStr + "&ChartType =" +
drpChartType.Se lectedItem.Valu e.ToLower() + "&Print=" +
printVersion.To String()
...
Catch e As Exception
Message.Text=e. Message
End Try
It handles exception fine before and after the statement:Chart Image.ImageUrl
....
but it seems not being able to catch the exception in ChartGenerator. aspx.vb
Now I am trying to do is handling the exception in ChartGenerator. aspx.vb.
but don't know what to do. with the following code in ChartGenerator. aspx.vb:
try

catch ex as exception
message.text=ex .message
Response.Redire ct("ChartGenera tor.aspx")
end try
I tried to let the chartGenerator. aspx display the exception using, but it
seems not working. Instead, it displays timeout message from sale.aspx.
Can you shed a light on me?
--
Betty
Aug 31 '06 #1
3 2243
Hello Betty,

Welcome.

As for the problem you mentioned, my understanding is you have two separate
page, one page(Sales.aspx ) use another page(ChartGener ator.aspx) to return
some dynamic image stream and display the image stream through Image
control. However, you found that you can not quite get the exception info
(occured in ChartGenerator. aspx page) in Sales.aspx , correct?

I think this is due to the ASP.NET page model, each page is only displaying
content/text which is writen into its own response stream. And since
sales.aspx and ChartGenerator. aspx are two separate page, they can not be
aware of any exception occured in the other one's processing stage.

For your scenario, I think your current idea on redirect the response
stream is a workable solution. You can catch the exception in the
ChartGenerator. aspx page and then redirect the current request to another
image stream or better a static image file (which display a error screen
message as picture), or you can directly use response.WriteF ile to writeout
that static image file (store in your web application's directory. Thus,
in the sales.aspx, the Image control can still get a valid image binary
stream and display the error screenshot.

e.g.

=============== ===========
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load

Try
If Request.QuerySt ring("fn") = Nothing Then
Throw New Exception("inva lid file name....")
End If
Catch ex As Exception

Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "image/gif"
Response.WriteF ile(Server.MapP ath("~/images/errorinfo.gif") )
Response.End()
End Try

End Sub
=============== =============

the limitation here is that such a static image file can not display
dynamic exception information(cal lstack, error message....). If you want to
display the error message through image stream, you'd better create a
custom httphandler which dynamically generate image stream(from given text)
and redirect your ChartGenerator. aspx page to that handler. How do you
think of this?

Here are some good articles mentioned creating httphandler to generate
dynamic image stream in asp.net:

#Build an ASP.NET Thumbnail Image Generator
http://www.eggheadcafe.com/articles/20041104.asp

http://davidhayden.com/blog/dave/arc...9/09/2459.aspx

http://www.microsoft.com/belux/msdn/...et/httphandler.
mspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 1 '06 #2
Steve,
Your explanation is very through and it makes perfect sense to me.
I will read article you provided and try to implement it.
You are one of the best among the microsoft discussion forum supports I have
been joined, including sql server discussion forum.
Good night.
--
Betty
"Steven Cheng[MSFT]" wrote:
Hello Betty,

Welcome.

As for the problem you mentioned, my understanding is you have two separate
page, one page(Sales.aspx ) use another page(ChartGener ator.aspx) to return
some dynamic image stream and display the image stream through Image
control. However, you found that you can not quite get the exception info
(occured in ChartGenerator. aspx page) in Sales.aspx , correct?

I think this is due to the ASP.NET page model, each page is only displaying
content/text which is writen into its own response stream. And since
sales.aspx and ChartGenerator. aspx are two separate page, they can not be
aware of any exception occured in the other one's processing stage.

For your scenario, I think your current idea on redirect the response
stream is a workable solution. You can catch the exception in the
ChartGenerator. aspx page and then redirect the current request to another
image stream or better a static image file (which display a error screen
message as picture), or you can directly use response.WriteF ile to writeout
that static image file (store in your web application's directory. Thus,
in the sales.aspx, the Image control can still get a valid image binary
stream and display the error screenshot.

e.g.

=============== ===========
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load

Try
If Request.QuerySt ring("fn") = Nothing Then
Throw New Exception("inva lid file name....")
End If
Catch ex As Exception

Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "image/gif"
Response.WriteF ile(Server.MapP ath("~/images/errorinfo.gif") )
Response.End()
End Try

End Sub
=============== =============

the limitation here is that such a static image file can not display
dynamic exception information(cal lstack, error message....). If you want to
display the error message through image stream, you'd better create a
custom httphandler which dynamically generate image stream(from given text)
and redirect your ChartGenerator. aspx page to that handler. How do you
think of this?

Here are some good articles mentioned creating httphandler to generate
dynamic image stream in asp.net:

#Build an ASP.NET Thumbnail Image Generator
http://www.eggheadcafe.com/articles/20041104.asp

http://davidhayden.com/blog/dave/arc...9/09/2459.aspx

http://www.microsoft.com/belux/msdn/...et/httphandler.
mspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 1 '06 #3
Thanks for the quick response.

Glad that the suggsetion is helpful to you and appreciate your feedback:)

Good luck!

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 1 '06 #4

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

Similar topics

1
3582
by: Agency | last post by:
I'm still working on the bpm counter. I need to have at least 2 displays that are not static. One would be a clock/running time and the other would should the current beat count. How would I do this in Tkinter? I was thinkning of canvas-text, but there must be a widget for doing this kind of display. I'm a bit lost and would appreciate some help.
2
6768
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on mouseOver instead of the popup I coded. The section of code below works perfectly in Firefox but not at all in IE (why am I not surprised?). The page is nearly 100% dynamic, so this is extracted from the source of a test page. The code in...
2
3105
by: Benedict Teoh | last post by:
I created a dropdownlist containing day, month and year field and expose a property to assign a date. When I call from a aspx page and assign the value, the new date is not displayed until a submit is performed. How do I force the usercontrol to display the newly assigned date? I don't have this problem if I place the two dropdownlist and the year field directly on the aspx page.
4
7222
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server error" in the exception message. I am able to do this fine with another .aspx page that has no code-behind. The page that has code-behind throws the exception. What I am doing is getting the .aspx response, reading the stream, replacing
2
4475
by: Joe Campbell | last post by:
I have a DBA that wrote a stored procedure that does a SELECT from a particluar SQL Server table. Within that stored procedure he links over to grab a column from another database table. I need to display this information in 5 different label controls in an ASP.NET web page. When I test the stored procedure in a GridView all the columns display correctly (I am not manually defining the columns). When I try to use labels I can display all...
1
2608
by: John Phelan-Cummings | last post by:
When I add the name of a new individual in a, bound form, it will not display that person’s name in a label control of a second unbound form. I have a scheduling program that I am working on. Included in the application program is a data “GRID” which I believe was created using Visual Basic, not standard Access. Its purpose is to display the results of a range of “from-to-dates” of registrations for different clients. The difficulty...
1
4519
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I want only one instance of the FCKEditor on the screen at one time so I make tabs that the user can click and I store the values in variables behind the scenes. I change the CSS class on the link that is the currently selected one. I have a really...
4
1435
by: Darin | last post by:
I have a public class that I use to read columns out of a SQL database. In the try, catch, loop I want to display the error, and in the error I want to display the calling routine (and helpfully the line # from the calling routine). Is that possible? The stacktrace gives me the system information (at system.data.sqlclient.sqlconnection.onerror, etc). I am looking for my routine that called it.
2
1466
by: jay123 | last post by:
Hello, I am making a project in VS2008, C#. Background of prob: I have integrated a postcode(UK- its like if someone enters postcode and clicks button to retrieve the address, he gets all the addresses at that postcode(or street in indian language) web service, now the problem is as we go to our client with all of our project in laptop and while giving demo if we click on button we get an error saying : The request failed with HTTP...
0
8495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6815
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.