<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dataplex Technology Solutions Blog &#187; ASP.NET MVC</title>
	<atom:link href="http://dataplex.org/blog/category/programming/asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://dataplex.org/blog</link>
	<description>Web Development, Network Administration, Informaton Security</description>
	<lastBuildDate>Tue, 31 Aug 2010 09:44:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ASP.NET MVC AJAX RedirectToAction</title>
		<link>http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/</link>
		<comments>http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 19:26:11 +0000</pubDate>
		<dc:creator>dpx</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ajax.beginform]]></category>
		<category><![CDATA[redirecttoaction]]></category>

		<guid isPermaLink="false">http://dataplex.org/blog/?p=211</guid>
		<description><![CDATA[I had a problem recently in an application I was writing where I popped up a dialog box (jQuery Dialog) with a registration partial view. Once the user successfully registered, I checked to see if the request was an ajax request (Request.IsAjaxRequest()) and returned RedirectToAction to go to the home page. However, what ended up [...]]]></description>
			<content:encoded><![CDATA[<p>I had a problem recently in an application I was writing where I popped up a dialog box (jQuery Dialog) with a registration partial view. Once the user successfully registered, I checked to see if the request was an ajax request (Request.IsAjaxRequest()) and returned RedirectToAction to go to the home page. However, what ended up happening was this result was being shown in the Dialog box. As you can imagine, it was the full front page in the dialog, on top of the front page.</p>
<p>This was happening because the Ajax.BeginForm AjaxOptions UpdateTargetId was set and the result was being forced into that element regardless of the type of action being returned. To get around this I first returned a PartialRegistrationSuccess view that just said &#8220;Registration Successful. Please close this window and login&#8221;. I wasn&#8217;t very happy with this because without the AJAX request, the user was automatically logged in.</p>
<p>What I ended up doing was returning a partial login view that had a normal form on it (Html.BeginForm). This way, when the user logged in through the dialog box, the full page was redirected back to the home page on success, or a full login page on failure. This is much more graceful than the registration success message.</p>
]]></content:encoded>
			<wfw:commentRss>http://dataplex.org/blog/2009/11/asp-net-mvc-ajax-redirecttoaction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
