|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I stop ASPX file rendering in Page_Load event?Within my code behind's Page_Load event, I need to prevent the aspx contents be rendered. I tried to use Response.End() , but ASP.NET gives me "System.Threading.ThreadAbortException" exception. I also tried Response.OutputStream.Flush(); Response.OutputStream.Close(); Or Response.Flush(); Response.Close(); They do not stop ASP.NET to render the rest of contents. How can I stop ASP.NET to rendering the rest of contents? Thank you, Alan I think that exception is normal, no? Note: ThreadAbortException cannot be
caught. You get that also if you try and do a response.redirect. Show quoteHide quote "A.M-SG" <alanalan@newsgroup.nospam> wrote in message news:OghTBwv3FHA.1188@TK2MSFTNGP12.phx.gbl... > > Hi, > > Within my code behind's Page_Load event, I need to prevent the aspx > contents be rendered. > > I tried to use Response.End() , but ASP.NET gives me > "System.Threading.ThreadAbortException" exception. I also tried > > Response.OutputStream.Flush(); > Response.OutputStream.Close(); > > Or > > Response.Flush(); > Response.Close(); > > They do not stop ASP.NET to render the rest of contents. > > How can I stop ASP.NET to rendering the rest of contents? > > Thank you, > Alan >
Show quote
Hide quote
> Hi, For a less drastic way, try to set the controls to Visible=false.> > Within my code behind's Page_Load event, I need to prevent the aspx contents > be rendered. > > I tried to use Response.End() , but ASP.NET gives me > "System.Threading.ThreadAbortException" exception. I also tried > > Response.OutputStream.Flush(); > Response.OutputStream.Close(); > > Or > > Response.Flush(); > Response.Close(); > > They do not stop ASP.NET to render the rest of contents. > > How can I stop ASP.NET to rendering the rest of contents? > > Thank you, > Alan Or even "this.Visible = false;" to hide the complete control. Hans Kesting On Tue, 01 Nov 2005 10:50:39 -0500, A.M-SG wrote:
Show quoteHide quote > Explain a little more of what you are doing and why you want to stop> Hi, > > Within my code behind's Page_Load event, I need to prevent the aspx contents > be rendered. > > I tried to use Response.End() , but ASP.NET gives me > "System.Threading.ThreadAbortException" exception. I also tried > > Response.OutputStream.Flush(); > Response.OutputStream.Close(); > > Or > > Response.Flush(); > Response.Close(); > > They do not stop ASP.NET to render the rest of contents. > > How can I stop ASP.NET to rendering the rest of contents? > > Thank you, > Alan rendering. If you must try overriding the Render method - don't invoke the base class Render and don't output anything. The System.Threading.ThreadAbortException is by design..
http://support.microsoft.com/kb/312629/EN-US/ use try - catch and ignore this exception .. Show quoteHide quote "A.M-SG" wrote: > > Hi, > > Within my code behind's Page_Load event, I need to prevent the aspx contents > be rendered. > > I tried to use Response.End() , but ASP.NET gives me > "System.Threading.ThreadAbortException" exception. I also tried > > Response.OutputStream.Flush(); > Response.OutputStream.Close(); > > Or > > Response.Flush(); > Response.Close(); > > They do not stop ASP.NET to render the rest of contents. > > How can I stop ASP.NET to rendering the rest of contents? > > Thank you, > Alan > > > Thank you very much guys.
Now in know that the exception is normal and I can cach/ignore it. this.Visible = false and also overriding Render methods also are good idea. Thank you again, Alan Show quoteHide quote "A.M-SG" <alanalan@newsgroup.nospam> wrote in message news:OghTBwv3FHA.1188@TK2MSFTNGP12.phx.gbl... > > Hi, > > Within my code behind's Page_Load event, I need to prevent the aspx > contents be rendered. > > I tried to use Response.End() , but ASP.NET gives me > "System.Threading.ThreadAbortException" exception. I also tried > > Response.OutputStream.Flush(); > Response.OutputStream.Close(); > > Or > > Response.Flush(); > Response.Close(); > > They do not stop ASP.NET to render the rest of contents. > > How can I stop ASP.NET to rendering the rest of contents? > > Thank you, > Alan > Don't bother trying to catch it. That exception type is very perculiar. You
cannot catch it at all. Greg Show quoteHide quote "A.M-SG" <alanalan@newsgroup.nospam> wrote in message news:OOx0EEx3FHA.1596@tk2msftngp13.phx.gbl... > Thank you very much guys. > > Now in know that the exception is normal and I can cach/ignore it. > > this.Visible = false and also overriding Render methods also are good > idea. > > Thank you again, > Alan > > > "A.M-SG" <alanalan@newsgroup.nospam> wrote in message > news:OghTBwv3FHA.1188@TK2MSFTNGP12.phx.gbl... >> >> Hi, >> >> Within my code behind's Page_Load event, I need to prevent the aspx >> contents be rendered. >> >> I tried to use Response.End() , but ASP.NET gives me >> "System.Threading.ThreadAbortException" exception. I also tried >> >> Response.OutputStream.Flush(); >> Response.OutputStream.Close(); >> >> Or >> >> Response.Flush(); >> Response.Close(); >> >> They do not stop ASP.NET to render the rest of contents. >> >> How can I stop ASP.NET to rendering the rest of contents? >> >> Thank you, >> Alan >> > >
Other interesting topics
maximum datagrid row count?
preserving carriage returns Technollgoy Rat Race!!! AddHandler Problem Programmatically click asp.net button via javascript? Pre compiling web site in 2.0 webconfig file Help on Store procedure and ASP web page Upload if files from client PC or local network Filter Collection |
|||||||||||||||||||||||