<?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: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comments on: Authenticated web services calls with Asp.Net MVC</title>
	<atom:link href="http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authenticated-web-services-calls-with-asp-net-mvc</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Viky</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-53666</link>
		<dc:creator>Viky</dc:creator>
		<pubDate>Tue, 16 Feb 2010 04:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-53666</guid>
		<description>Good one</description>
		<content:encoded><![CDATA[<p>Good one</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-2/#comment-51176</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51176</guid>
		<description>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.

Now, as for sending redefined JSON objects...I&#039;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for -- return data to the browse.</description>
		<content:encoded><![CDATA[<p>@JC Grubbs: at worst it would result in 2 calls for every request.  But for my application, I tend to see a lot of calls in bursts.  That is why I do a time check on my call.</p>
<p>Now, as for sending redefined JSON objects&#8230;I&#8217;m not sure I could do that without doing a LOT of extra work, especially for Load calls (which recieve HTML, not JSON).  Plus, most of my get calls are already returning a lot of data.  In fact, that is what half of my XHR calls are for &#8212; return data to the browse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC Grubbs</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51174</link>
		<dc:creator>JC Grubbs</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51174</guid>
		<description>Wouldn&#039;t this result in making two XHR calls for every request...one for the authentication check and another for the &quot;real&quot; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#039;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this result in making two XHR calls for every request&#8230;one for the authentication check and another for the &#8220;real&#8221; request?  Another option is to turn off Forms Authentication for all your web service URLs and then use a re-invention of the [Authorize] filter on those action methods that doesn&#8217;t redirect back to Login but instead sends some predefined JSON object indicating that the user is not authenticated or allows the actual method to be called.  This results in a single XHR call and allows you to just handle the special authentication value in the direct jQuery method instead of wrapping it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51143</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51143</guid>
		<description>&lt;a href=&quot;#comment-51142&quot; rel=&quot;nofollow&quot;&gt;@Chris Brandsma&lt;/a&gt; 
Oops sorry, I wasn&#039;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</description>
		<content:encoded><![CDATA[<p><a href="#comment-51142" rel="nofollow">@Chris Brandsma</a><br />
Oops sorry, I wasn&#8217;t clear enough.  I meant the wrapped JQuery calls, but I suppose that is not a huge amount of overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51142</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51142</guid>
		<description>Hi guys,

Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#039;ll look into what Sergio and Ben were talking about.

But a few things:
@John Sonmez: You shouldn&#039;t have to write it for every page.  Put the code in a js file and load it in a master page.

@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Good suggestions all rounds.  Pretty much proves I should have spent a little more time on the post.  But I&#8217;ll look into what Sergio and Ben were talking about.</p>
<p>But a few things:<br />
@John Sonmez: You shouldn&#8217;t have to write it for every page.  Put the code in a js file and load it in a master page.</p>
<p>@Bill Pierce: Keeping the session alive is only a temporary fix.  Do you keep it alive all night? All weekend?  Each session is taking server resources.  At some point you have to let the session die and move on.  The other option is to abuse setInterval.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Pereira</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51119</link>
		<dc:creator>Sergio Pereira</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51119</guid>
		<description>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#039;ll have problems with 3rd party plugins that use them.
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#039;m done).
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</description>
		<content:encoded><![CDATA[<p>I try to avoid wrapping the jQuery calls if possible. Wrapping jQuery ajax means you&#8217;ll have problems with 3rd party plugins that use them.<br />
As Mike suggested, I normally use the jQuery ajaxError event to detect a session expired and force a page reload (which will take me to the login page and redirect me back to the right place when I&#8217;m done).<br />
For that to work I make my login page return an HTTP status code like 401-Unauthorized and check for that in the ajaxError event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51118</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 16:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51118</guid>
		<description>I would have opted for the simpler solution and just keep the user&#039;s session alive as long as they do not navigate away from the site.

http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx

-Bill</description>
		<content:encoded><![CDATA[<p>I would have opted for the simpler solution and just keep the user&#8217;s session alive as long as they do not navigate away from the site.</p>
<p><a href="http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx" rel="nofollow">http://blechie.com/WPierce/archive/2007/11/26/Session-Keep-Alive-with-MonoRail-and-jQuery.aspx</a></p>
<p>-Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51115</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51115</guid>
		<description>Hmm... I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#039;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; I am wondering if there might be a custom HttpModule solution here that could reduce the code on each page, so that you could write the module once and not have to remember to use the special handling for each page of the application.  Don&#8217;t get me wrong I like your solution, its a very smart way to handle putting the logic that deals with the login page in one place.  The only problem I have is that it still has to be used for every page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Speranza</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51112</link>
		<dc:creator>Paul Speranza</dc:creator>
		<pubDate>Mon, 07 Dec 2009 13:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51112</guid>
		<description>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.

Simple but it works. If anyone has something different or better let&#039;s hear it.</description>
		<content:encoded><![CDATA[<p>I agree with Mark. I make one call that returns a ServiceCallResult object that has a result property to hold data coming back, a success property and a collection of status/error messages with codes that get populated when success is false to tell me (without details) what is wrong like a session timeout, not authenticated/authorized.</p>
<p>Simple but it works. If anyone has something different or better let&#8217;s hear it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</title>
		<link>http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/comment-page-1/#comment-51100</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #492</dc:creator>
		<pubDate>Mon, 07 Dec 2009 08:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/12/06/authenticated-web-services-calls-with-asp-net-mvc/#comment-51100</guid>
		<description>[...] Authenticated web services calls with Asp.Net MVC - Chris Brandsma looks at how you can handle the problems caused by sessions timing out in complex Ajax based applications and how you can handle re-authentication [...]</description>
		<content:encoded><![CDATA[<p>[...] Authenticated web services calls with Asp.Net MVC &#8211; Chris Brandsma looks at how you can handle the problems caused by sessions timing out in complex Ajax based applications and how you can handle re-authentication [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

