<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Use jQuery to catch and display ASP.NET AJAX service errors</title>
	<atom:link href="http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/feed/" rel="self" type="application/rss+xml" />
	<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/</link>
	<description>ASP.NET and AJAX code, ideas, and examples.</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:50:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Thomas Girotto</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-44473</link>
		<dc:creator>Thomas Girotto</dc:creator>
		<pubDate>Mon, 01 Aug 2011 10:16:41 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-44473</guid>
		<description>Hey guys,
That was an interesting post, but i can&#039;t find something that solve my use case:
I have a big treatment on the server side, and i can have many exceptions that can happen. I manage my exceptions there and allow my treatment to continue even if an exception occurs (i log the error and i have a custom exception type in which i have a List ListMessages {get;set;} property that contains all my error messages).
So at the end of the treatment, i&#039;d like to be able to get my custom exception on the client side and access the ListMessages property in order to format my messages into a nice HTML format.

I actually get my custom type error, but i can&#039;t access my custom property inside. I only have the classic Message property.
Does someone have any idea on how to do that?

I&#039;d like to avoid concatenate all my messages in the exception&#039;s Message property.

Thanks!</description>
		<content:encoded><![CDATA[<p>Hey guys,<br />
That was an interesting post, but i can&#8217;t find something that solve my use case:<br />
I have a big treatment on the server side, and i can have many exceptions that can happen. I manage my exceptions there and allow my treatment to continue even if an exception occurs (i log the error and i have a custom exception type in which i have a List ListMessages {get;set;} property that contains all my error messages).<br />
So at the end of the treatment, i&#8217;d like to be able to get my custom exception on the client side and access the ListMessages property in order to format my messages into a nice HTML format.</p>
<p>I actually get my custom type error, but i can&#8217;t access my custom property inside. I only have the classic Message property.<br />
Does someone have any idea on how to do that?</p>
<p>I&#8217;d like to avoid concatenate all my messages in the exception&#8217;s Message property.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-44374</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 18 Jul 2011 20:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-44374</guid>
		<description>&lt;code&gt;$.parseJSON()&lt;/code&gt; hadn&#039;t been added yet when I published this (and keep in mind that &lt;code&gt;$.parseJSON()&lt;/code&gt; falls back to &lt;code&gt;eval()&lt;/code&gt; too in browsers without native parsing).  As I mentioned in the post, &lt;code&gt;eval()&lt;/code&gt; is not very dangerous when used against BCL-generated error messages. If someone has compromised your server to the point that they could change its error messages, they could just inject script directly and would have no need for the &lt;code&gt;eval()&lt;/code&gt; vector.</description>
		<content:encoded><![CDATA[<p><code>$.parseJSON()</code> hadn&#8217;t been added yet when I published this (and keep in mind that <code>$.parseJSON()</code> falls back to <code>eval()</code> too in browsers without native parsing).  As I mentioned in the post, <code>eval()</code> is not very dangerous when used against BCL-generated error messages. If someone has compromised your server to the point that they could change its error messages, they could just inject script directly and would have no need for the <code>eval()</code> vector.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seyed Mohammad Hossein Mayboudi</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-44373</link>
		<dc:creator>Seyed Mohammad Hossein Mayboudi</dc:creator>
		<pubDate>Mon, 18 Jul 2011 19:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-44373</guid>
		<description>Dear Dave Ward, using eval is evil !? and dear reader, instead of using eval(), try to use $.parseJSON() [http://api.jquery.com/jQuery.parseJSON/]</description>
		<content:encoded><![CDATA[<p>Dear Dave Ward, using eval is evil !? and dear reader, instead of using eval(), try to use $.parseJSON() [http://api.jquery.com/jQuery.parseJSON/]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saeed Neamati</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-43436</link>
		<dc:creator>Saeed Neamati</dc:creator>
		<pubDate>Sat, 28 May 2011 08:46:03 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-43436</guid>
		<description>You do upload informative articles, really!
I loved this article and I think the time has gone to shift from Microsoft&#039;s sucky AJAX solutions to more native, jQuery solutions.
Thank you for sharing this article.</description>
		<content:encoded><![CDATA[<p>You do upload informative articles, really!<br />
I loved this article and I think the time has gone to shift from Microsoft&#8217;s sucky AJAX solutions to more native, jQuery solutions.<br />
Thank you for sharing this article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PageMethods usando JQuery &#8211; Parte 2 &#171; Diego Doná &#124; Designer, Developer</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-42546</link>
		<dc:creator>PageMethods usando JQuery &#8211; Parte 2 &#171; Diego Doná &#124; Designer, Developer</dc:creator>
		<pubDate>Sun, 20 Mar 2011 17:31:11 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-42546</guid>
		<description>[...] http://encosia.com/2009/03/04/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/ (referência para montar a função usada no callback de erro) [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://encosia.com/2009/03/04/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/" rel="nofollow">http://encosia.com/2009/03/04/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/</a> (referência para montar a função usada no callback de erro) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdaniel7</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-40131</link>
		<dc:creator>bdaniel7</dc:creator>
		<pubDate>Mon, 18 Oct 2010 17:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-40131</guid>
		<description>I&#039;m using ASP.NET Webforms with jQuery and this solution:

$(document).ajaxError(logEvent);

function logEvent(event, xhr, settings, err)
{
    jsonError = JSON.parse(xhr.responseText);
    var s = &lt;strong&gt;Message: &lt;/strong&gt;&#039; + jsonError.Message +
			&#039;&lt;strong&gt;StackTrace: &lt;/strong&gt;&#039; + jsonError.StackTrace;
    $(&#039;#log&#039;).empty().append(&#039;&#039; + s + &#039;&#039;).dialog();
}

And in jsonError I get an object with ExceptionType, Message and StackTrace properties.</description>
		<content:encoded><![CDATA[<p>I&#8217;m using ASP.NET Webforms with jQuery and this solution:</p>
<p>$(document).ajaxError(logEvent);</p>
<p>function logEvent(event, xhr, settings, err)<br />
{<br />
    jsonError = JSON.parse(xhr.responseText);<br />
    var s = <strong>Message: </strong>&#8216; + jsonError.Message +<br />
			&#8216;<strong>StackTrace: </strong>&#8216; + jsonError.StackTrace;<br />
    $(&#8216;#log&#8217;).empty().append(&#8221; + s + &#8221;).dialog();<br />
}</p>
<p>And in jsonError I get an object with ExceptionType, Message and StackTrace properties.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-39928</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Wed, 22 Sep 2010 14:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-39928</guid>
		<description>Sure.  The .NET framework is large enough that it&#039;s easy to overlook handy classes like that one.  In fact, I&#039;ve been guilty of manually concatenating JSON strings myself, before I discovered how easy JavaScriptSerializer is to use.</description>
		<content:encoded><![CDATA[<p>Sure.  The .NET framework is large enough that it&#8217;s easy to overlook handy classes like that one.  In fact, I&#8217;ve been guilty of manually concatenating JSON strings myself, before I discovered how easy JavaScriptSerializer is to use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Brower</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-39843</link>
		<dc:creator>Robert Brower</dc:creator>
		<pubDate>Fri, 10 Sep 2010 08:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-39843</guid>
		<description>Thanks Dave. Perfect! I did not even know the JavaScriptSerializer existed! Does that ever happen to you?</description>
		<content:encoded><![CDATA[<p>Thanks Dave. Perfect! I did not even know the JavaScriptSerializer existed! Does that ever happen to you?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-39837</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Thu, 09 Sep 2010 12:56:41 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-39837</guid>
		<description>I tried your code here and it worked.  Is it possible that you have unescaped double quotes in errorMessage, helpKeyword, or ex.ToString()?  Take a look at the response in Firebug to see exactly what&#039;s coming back.

A good overall solution to those kinds of problems is to not build the JSON manually.  Try using JavaScriptSerializer instead:

&lt;pre lang=&quot;csharp&quot;&gt;var js = new JavaScriptSerializer();

string json = js.Serialize(new {
  Message = errorMessage,
  HelpKeyword = helpKeyword,
  SupportDescription = ex.ToString()
});&lt;/pre&gt;

It does a good job of handling the escaping issues.</description>
		<content:encoded><![CDATA[<p>I tried your code here and it worked.  Is it possible that you have unescaped double quotes in errorMessage, helpKeyword, or ex.ToString()?  Take a look at the response in Firebug to see exactly what&#8217;s coming back.</p>
<p>A good overall solution to those kinds of problems is to not build the JSON manually.  Try using JavaScriptSerializer instead:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">var js <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> JavaScriptSerializer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #FF0000;">string</span> json <span style="color: #008000;">=</span> js.<span style="color: #0000FF;">Serialize</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> <span style="color: #000000;">&#123;</span>
  Message <span style="color: #008000;">=</span> errorMessage,
  HelpKeyword <span style="color: #008000;">=</span> helpKeyword,
  SupportDescription <span style="color: #008000;">=</span> ex.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>It does a good job of handling the escaping issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Brower</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-39836</link>
		<dc:creator>Robert Brower</dc:creator>
		<pubDate>Thu, 09 Sep 2010 12:23:01 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-39836</guid>
		<description>Great blog.

If we are limited to getting ExceptionType, Message, and StackTrace from the erroneous return from a web service, then how can I pass additonal information from the server to the client (javascript) error handler?

In my code, I have tried to encode more information, i.e. Message, HelpKeyword, and SupportDescription, into Message using JSON but it&#039;s not working.

Code from exception handling...

&lt;pre lang=&quot;csharp&quot;&gt;// get an extra tidbit of info that javascript needs to set up a hyperlink to the help topic wiki relating to the exception.
string helpKeyword = StandardReportingAPI.Logging.Log.GetExceptionKeyword(ex);

string json = string.Format(&quot;{{\&quot;Message\&quot;:\&quot;{0}\&quot;,\&quot;HelpKeyword\&quot;:\&quot;{1}\&quot;,\&quot;SupportDescription\&quot;:\&quot;{2}\&quot;}}&quot;,
                errorMessage, helpKeyword, ex.ToString());

SoapException se = new SoapException(json,
                SoapException.ServerFaultCode, uri);&lt;/pre&gt;

The Javascript looks like this:

&lt;pre lang=&quot;javascript&quot;&gt;$(document).ready(function() {
        $.ajax({
            type: &quot;POST&quot;,
            contentType: &quot;application/json; charset=utf-8&quot;,
            dataType: &quot;json&quot;,
            data: &quot;{}&quot;,
            url: &quot;WebUserControls/RSSFeedService.asmx/GetRSSFeed&quot;,
//            data: &quot;{ &#039;Dividend&#039;: &#039;&quot; + $(&quot;#Dividend&quot;).val() + &quot;&#039; }&quot;,
            error: function(xhr, status, error) {
                // Boil the ASP.NET AJAX error down to JSON.
            var err = eval(&quot;(&quot; + xhr.responseText + &quot;)&quot;);
            var customErr = eval(&quot;(&quot; + err.Message + &quot;)&quot;);
            

                var elm = $get(&#039;rssfeedcontentpanel&#039;);
                Sys.UI.DomElement.removeCssClass(elm, &#039;loading&#039;);
                Sys.UI.DomElement.addCssClass(elm, &#039;error&#039;);

                $get(PageErrorLabelID).innerHTML = err.Message;
                $get(PageErrorHelpKeywordHiddenFieldID).value = &#039;&#039;;
                $get(PageErrorSupportDescriptionHiddenFieldID).value = &#039;&#039;;
                showDialog(PageErrorModalPopupExtenderID);
            },
            success: function() {
                // Remove the .loading CSS from the div, to remove the
                //  progress indicator background.
                var elm = $get(&#039;rssfeedcontentpanel&#039;);
                Sys.UI.DomElement.removeCssClass(elm, &#039;loading&#039;);
                Sys.UI.DomElement.removeCssClass(elm, &#039;height100px&#039;);

                // Fill the div with the HTML generated from the user control.
                elm.innerHTML = result;
            }
        });
});&lt;/pre&gt;

If you guessed that the line of javascript that fails is var customErr = eval(&quot;(&quot; + err.Message + &quot;)&quot;); then you were right.

I get the error: Microsoft JScript compilation error: Unterminated string constant

I think this is because of the contents of the ex.ToString() which is the value of SupportDescription.

Is there a better way, one that might work?

Thanks.

Robert</description>
		<content:encoded><![CDATA[<p>Great blog.</p>
<p>If we are limited to getting ExceptionType, Message, and StackTrace from the erroneous return from a web service, then how can I pass additonal information from the server to the client (javascript) error handler?</p>
<p>In my code, I have tried to encode more information, i.e. Message, HelpKeyword, and SupportDescription, into Message using JSON but it&#8217;s not working.</p>
<p>Code from exception handling&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// get an extra tidbit of info that javascript needs to set up a hyperlink to the help topic wiki relating to the exception.</span>
<span style="color: #FF0000;">string</span> helpKeyword <span style="color: #008000;">=</span> StandardReportingAPI.<span style="color: #0000FF;">Logging</span>.<span style="color: #0000FF;">Log</span>.<span style="color: #0000FF;">GetExceptionKeyword</span><span style="color: #000000;">&#40;</span>ex<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #FF0000;">string</span> json <span style="color: #008000;">=</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{{<span style="color: #008080; font-weight: bold;">\&quot;</span>Message<span style="color: #008080; font-weight: bold;">\&quot;</span>:<span style="color: #008080; font-weight: bold;">\&quot;</span>{0}<span style="color: #008080; font-weight: bold;">\&quot;</span>,<span style="color: #008080; font-weight: bold;">\&quot;</span>HelpKeyword<span style="color: #008080; font-weight: bold;">\&quot;</span>:<span style="color: #008080; font-weight: bold;">\&quot;</span>{1}<span style="color: #008080; font-weight: bold;">\&quot;</span>,<span style="color: #008080; font-weight: bold;">\&quot;</span>SupportDescription<span style="color: #008080; font-weight: bold;">\&quot;</span>:<span style="color: #008080; font-weight: bold;">\&quot;</span>{2}<span style="color: #008080; font-weight: bold;">\&quot;</span>}}&quot;</span>,
                errorMessage, helpKeyword, ex.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
SoapException se <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SoapException<span style="color: #000000;">&#40;</span>json,
                SoapException.<span style="color: #0000FF;">ServerFaultCode</span>, uri<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>The Javascript looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>
            contentType<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;application/json; charset=utf-8&quot;</span><span style="color: #339933;">,</span>
            dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;json&quot;</span><span style="color: #339933;">,</span>
            data<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;{}&quot;</span><span style="color: #339933;">,</span>
            url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;WebUserControls/RSSFeedService.asmx/GetRSSFeed&quot;</span><span style="color: #339933;">,</span>
<span style="color: #006600; font-style: italic;">//            data: &quot;{ 'Dividend': '&quot; + $(&quot;#Dividend&quot;).val() + &quot;' }&quot;,</span>
            error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>xhr<span style="color: #339933;">,</span> <span style="color: #000066;">status</span><span style="color: #339933;">,</span> error<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// Boil the ASP.NET AJAX error down to JSON.</span>
            <span style="color: #003366; font-weight: bold;">var</span> err <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;(&quot;</span> <span style="color: #339933;">+</span> xhr.<span style="color: #660066;">responseText</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> customErr <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;(&quot;</span> <span style="color: #339933;">+</span> err.<span style="color: #660066;">Message</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
                <span style="color: #003366; font-weight: bold;">var</span> elm <span style="color: #339933;">=</span> $get<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rssfeedcontentpanel'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Sys.<span style="color: #660066;">UI</span>.<span style="color: #660066;">DomElement</span>.<span style="color: #660066;">removeCssClass</span><span style="color: #009900;">&#40;</span>elm<span style="color: #339933;">,</span> <span style="color: #3366CC;">'loading'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Sys.<span style="color: #660066;">UI</span>.<span style="color: #660066;">DomElement</span>.<span style="color: #660066;">addCssClass</span><span style="color: #009900;">&#40;</span>elm<span style="color: #339933;">,</span> <span style="color: #3366CC;">'error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                $get<span style="color: #009900;">&#40;</span>PageErrorLabelID<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> err.<span style="color: #660066;">Message</span><span style="color: #339933;">;</span>
                $get<span style="color: #009900;">&#40;</span>PageErrorHelpKeywordHiddenFieldID<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
                $get<span style="color: #009900;">&#40;</span>PageErrorSupportDescriptionHiddenFieldID<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
                showDialog<span style="color: #009900;">&#40;</span>PageErrorModalPopupExtenderID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// Remove the .loading CSS from the div, to remove the</span>
                <span style="color: #006600; font-style: italic;">//  progress indicator background.</span>
                <span style="color: #003366; font-weight: bold;">var</span> elm <span style="color: #339933;">=</span> $get<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rssfeedcontentpanel'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Sys.<span style="color: #660066;">UI</span>.<span style="color: #660066;">DomElement</span>.<span style="color: #660066;">removeCssClass</span><span style="color: #009900;">&#40;</span>elm<span style="color: #339933;">,</span> <span style="color: #3366CC;">'loading'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Sys.<span style="color: #660066;">UI</span>.<span style="color: #660066;">DomElement</span>.<span style="color: #660066;">removeCssClass</span><span style="color: #009900;">&#40;</span>elm<span style="color: #339933;">,</span> <span style="color: #3366CC;">'height100px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #006600; font-style: italic;">// Fill the div with the HTML generated from the user control.</span>
                elm.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> result<span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you guessed that the line of javascript that fails is var customErr = eval(&#8220;(&#8221; + err.Message + &#8220;)&#8221;); then you were right.</p>
<p>I get the error: Microsoft JScript compilation error: Unterminated string constant</p>
<p>I think this is because of the contents of the ex.ToString() which is the value of SupportDescription.</p>
<p>Is there a better way, one that might work?</p>
<p>Thanks.</p>
<p>Robert</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: epik</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-39366</link>
		<dc:creator>epik</dc:creator>
		<pubDate>Fri, 16 Jul 2010 08:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-39366</guid>
		<description>I have the same need of Adrian.
Is there a way to get detailed ajax errors mainteining customError mode=&quot;On&quot;??</description>
		<content:encoded><![CDATA[<p>I have the same need of Adrian.<br />
Is there a way to get detailed ajax errors mainteining customError mode=&#8221;On&#8221;??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: uberVU - social comments</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-38481</link>
		<dc:creator>uberVU - social comments</dc:creator>
		<pubDate>Thu, 22 Apr 2010 09:56:03 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-38481</guid>
		<description>&lt;strong&gt;Social comments and analytics for this post...&lt;/strong&gt;

This post was mentioned on Twitter by nituver83: error handling in Jquery ajax very good article http://bit.ly/6oNU6...</description>
		<content:encoded><![CDATA[<p><strong>Social comments and analytics for this post&#8230;</strong></p>
<p>This post was mentioned on Twitter by nituver83: error handling in Jquery ajax very good article <a href="http://bit.ly/6oNU6.." rel="nofollow">http://bit.ly/6oNU6..</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-38469</link>
		<dc:creator>Adrian</dc:creator>
		<pubDate>Wed, 21 Apr 2010 12:27:55 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-38469</guid>
		<description>How can I still get the error when using customErrors mode=&quot;On&quot;.
I have the same problem as jrummell but I need to keep customErrors set to On.

Thanks</description>
		<content:encoded><![CDATA[<p>How can I still get the error when using customErrors mode=&#8221;On&#8221;.<br />
I have the same problem as jrummell but I need to keep customErrors set to On.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-38230</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Fri, 05 Mar 2010 18:35:18 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-38230</guid>
		<description>You can definitely do something like this with MVC, but the implementation won&#039;t be very similar at all.  I wouldn&#039;t suggest using this post as a starting point for MVC AJAX error handling.</description>
		<content:encoded><![CDATA[<p>You can definitely do something like this with MVC, but the implementation won&#8217;t be very similar at all.  I wouldn&#8217;t suggest using this post as a starting point for MVC AJAX error handling.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://encosia.com/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/#comment-38179</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Tue, 02 Mar 2010 05:23:10 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=832#comment-38179</guid>
		<description>How can this be applied to c# and MVC?  

I have a controller, not a webmethod so when my controller method throws an exception, the resulting error returned to the browser contains the well formatted HTML error message .Net generates, rather than just the error message the thrown exception returns....</description>
		<content:encoded><![CDATA[<p>How can this be applied to c# and MVC?  </p>
<p>I have a controller, not a webmethod so when my controller method throws an exception, the resulting error returned to the browser contains the well formatted HTML error message .Net generates, rather than just the error message the thrown exception returns&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

