Yup, I did thought of Response.Clear(); but the problem was, that I allready
had made some headers like

Response.ContentType = "text/xml";

So I was playing arround with:
long lBegin     = Response.OutputStream.Position;

And the setting the position to lBegin, instead of clear.

It is not nice, so I am thinking of refactoring my code, and make a header
function to be called instead.

<Thomas/>


> -----Original Message-----
> From: Paul Brinkley-Rogers [mailto:[EMAIL PROTECTED]] 
> Sent: 7. oktober 2002 20:09
> To: dotnet
> Subject: RE: Catch the output stream
> 
> 
> catch(Exception err)
>     {
>       Response.Clear();
>       Response.Write("<?xml version='1.0' ?>");
>       Response.Write("<error>");
>       writeErrorException(err);
>       Response.Write("</error>");
>       ssSql.Close();
>       return;
>     }
> ______________________
> Paul Brinkley-Rogers
> Web Developer
> The Sak
> [EMAIL PROTECTED]
> http://www.thesak.com 
> 
> 
> 
> -----Original Message-----
> From: Thomas V. Nielsen [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, October 07, 2002 6:44 AM
> To: dotnet
> Subject: Catch the output stream
> 
> I have an object which I Serialize to XML using the XmlTextWriter and
> sending the output directly to the Response.OutoutStream.
> 
> However, if the Serialization fails for some reasion, I end up with a
> half
> serialized XML document, and my:
> 
> catch(Exception err)
>     {
>       Response.Write("<?xml version='1.0' ?>");
>       Response.Write("<error>");
>       writeErrorException(err);
>       Response.Write("</error>");
>       ssSql.Close();
>       return;
>     }
> 
> Which is a bit useless. What I need to do is to change what 
> is allready
> in
> the OutputStream, and replace it with my error response. Otherwise the
> systen in the other end, think it is some perfectly formated xml it is
> getting, but it is not.
> 
> <Thomas/>
> 
> ---
> You are currently subscribed to dotnet as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> %%email.unsub%%
> 
> ---------
> Administrated by 15 Seconds : http://www.15Seconds.com
> List Archives/Search : http://local.15Seconds.com/search
> Subscription Information : http://www.15seconds.com/listserv.htm
> Advertising Information: http://www.internet.com/mediakit/
> 
> 
> 
> ---
> You are currently subscribed to dotnet as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to 
> %%email.unsub%%
> 
> ---------
> Administrated by 15 Seconds : http://www.15Seconds.com
> List Archives/Search : http://local.15Seconds.com/search
> Subscription Information : http://www.15seconds.com/listserv.htm
> Advertising Information: http://www.internet.com/mediakit/
> 
> 

---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/


Reply via email to