<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx</link><description>One of my readers emailed me the following question I have a simple questions that my management asks me. When I see all kinds of exceptions thrown (null exceptions etc..), what is the user experience? Does their system hand these back to the user? does</description><dc:language>sv-SE</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#8353314</link><pubDate>Thu, 03 Apr 2008 12:02:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8353314</guid><dc:creator>Jesper</dc:creator><description>&lt;p&gt;This seems pretty clear - but I think it is best practice (or at least Code Analysis and FxCop says so) not to catch the general Exception but you should catch a specific exception - like NullReferenceException.&lt;/p&gt;
&lt;p&gt;How can you handle this? Do we have to predict every exception which can occur in the code?&lt;/p&gt;</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#8353321</link><pubDate>Thu, 03 Apr 2008 12:24:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8353321</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;the short answer is yes, as a developer you should probably anticipate what exceptions that can occurr in your code if you want it to run correctly. &amp;nbsp; MSDN help shows what exceptions can occurr in different methods. &lt;/p&gt;
&lt;p&gt;It may not always be feasible to know all types of exceptions that occurr in which case you could have multiple handlers, one more specific first and then end off with a more generic one. &amp;nbsp;But in reality the generic one should only be for exceptions that you really cant predict.&lt;/p&gt;
</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#8360265</link><pubDate>Sat, 05 Apr 2008 14:21:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8360265</guid><dc:creator>baal</dc:creator><description>&lt;p&gt;I got an Exception like below:&lt;/p&gt;
&lt;p&gt;Exception information: &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Exception type: HttpRequestValidationException &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Exception message: A potentially dangerous Request.Form value was detected from the client (CompanyIntroduce=&amp;quot;...a you buy &amp;lt;a href= &lt;a rel="nofollow" target="_new" href="http://buys...&amp;quot;"&gt;http://buys...&amp;quot;&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;How I can deal this Exception in try/catch? because this happen when post data(with html tags) to another page. I don't want to redirect to the custom errors page or show the exception/stack &amp;nbsp;on the page&lt;/p&gt;
</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#8364686</link><pubDate>Mon, 07 Apr 2008 11:02:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8364686</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Baal, &amp;nbsp;if you yourself is sending script tags then you have to remove the validation, but i would avoid sending script tags in the first place. &lt;/p&gt;
&lt;p&gt;To handle it you would have to handle it something like this... &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.romsteady.net/blog/2007/06/how-to-catch-httprequestvalidationexcep.html"&gt;http://www.romsteady.net/blog/2007/06/how-to-catch-httprequestvalidationexcep.html&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#8364804</link><pubDate>Mon, 07 Apr 2008 12:16:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8364804</guid><dc:creator>baal</dc:creator><description>&lt;p&gt;This is not I want. &amp;quot;Rom's Rants&amp;quot; blog is the same way as ustom errors page.&lt;/p&gt;
&lt;p&gt;in the &lt;/p&gt;
&lt;p&gt;try{&lt;/p&gt;
&lt;p&gt;UserName1 = Request.Cookies[&amp;quot;UserName1&amp;quot;].Value; &lt;/p&gt;
&lt;p&gt;UserName2 = Request.Cookies[&amp;quot;UserName2&amp;quot;].Value; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;catch&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;if line of UserName2 has exception, the UserName1 value I still have.&lt;/p&gt;
&lt;p&gt;what I want is : post data from a page to b page, some data is saved(soted in local var),when HttpRequestValidationException happen, lost data after it.&lt;/p&gt;
&lt;p&gt;so, this is why I want use try/catch&lt;/p&gt;
</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#8364818</link><pubDate>Mon, 07 Apr 2008 12:22:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8364818</guid><dc:creator>baal</dc:creator><description>&lt;p&gt;do you have any method to do like that?&lt;/p&gt;
</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#9335962</link><pubDate>Sat, 17 Jan 2009 16:05:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9335962</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;I have a quick question.&lt;/p&gt;
&lt;p&gt;If an app has started a thread that for some reason throws an exception shouldn't the Application_error in Global.Asax, or HttpApplication.Error catch this?&lt;/p&gt;
&lt;p&gt;I would think so, but that appears not necesarrily to be the case.&lt;/p&gt;
&lt;p&gt;This is a problem because exceptions from a non-request thread will apparently propagate to w3wp and recycle the application pool.&lt;/p&gt;
</description></item><item><title>re: Questions about .net Exceptions</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#9336587</link><pubDate>Sun, 18 Jan 2009 00:39:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9336587</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;the application_error will only catch it if it is happens on a request. &amp;nbsp;If you start your own thread you are correct in that it will crash if you throw an exception and don't handle it, so if you create your own threads you need to make sure to set up try/catch blocks if there is a chance that it will throw an exception.&lt;/p&gt;
</description></item><item><title>.NET Exceptions: Quick WinDbg/SOS tip on how to dump all the .NET exceptions on the heap</title><link>http://blogs.msdn.com/tess/archive/2008/04/01/questions-about-net-exceptions.aspx#9552648</link><pubDate>Thu, 16 Apr 2009 14:12:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9552648</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;Since a .net exception is a .NET object like any other, it gets stored on the GC heap when you (or some&lt;/p&gt;
</description></item></channel></rss>