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.