Thread was being aborted.

G

GTi

I have a aspx page and a code behind source.
I want to discard the aspx web form and create a new page from the code
behind source.

So I do:

string buf=null;
buf += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
buf += "<data>\n";
buf += "<action type='update' sid='1'/>\n";
buf += "</data>\n";

Page.Response.Clear();
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Page.Response.Expires = 0;
Page.Response.ContentType = "text/xml";
Page.Response.Write(buf);
Page.Response.BufferOutput = true;
Page.Response.End();

But then it gives me this error:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
 
G

Guest

Hi,
this is a normal behaviour since asp.net when it tries to end the current
process it throws threadabortexception. Having a try catch around your code
would sort it out.

--
 
G

GTi

Ibrahim said:
Hi,
this is a normal behaviour since asp.net when it tries to end the current
process it throws threadabortexception. Having a try catch around your code
would sort it out.

--
---------------------------
Thanks,
Ibrahim

Software Consultant - Web Development, GB

I have already done that, but in my mind a try/catch tells my that
something is broken and needed to be fixed, not bypassed.
In this case it is the .NET framework that must be fixed.

Thanks.
GTi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top