<?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: How to get URL rewriting to work with ASP.Net 2.0 Themes and form post-backs</title>
	<atom:link href="http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback/feed" rel="self" type="application/rss+xml" />
	<link>http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback</link>
	<description></description>
	<lastBuildDate>Wed, 13 Oct 2010 08:27:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dick Nagtegaal</title>
		<link>http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback/comment-page-1#comment-291</link>
		<dc:creator>Dick Nagtegaal</dc:creator>
		<pubDate>Wed, 15 Jul 2009 11:31:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jlcoady.net/?p=10#comment-291</guid>
		<description>I don&#039;t know if I didn&#039;t pay attention or if something changed (I&#039;ve cleared my browser cache and restarted IIS), but now your code doesn&#039;t seem to work at all. I have:
RewriteRule ^IdList/(\d*)/(\d*)\.html$ /Default.aspx?Id=$1&amp;SubId=$2

When I request http://www.example.com/IdList/1/2.html I am indeed redirected to Default.aspx?Id=1&amp;SubId=2.
With just the rewrite rule and without your code, the action attribute of the form tag contains &quot;Default.aspx?Id=1&amp;SubId=2&quot;. After adding your code it contains: &quot;2.html?Id=1&amp;SubId=2&quot;.

Although this does work, clicking a button on the form changes the url in the address bar to &quot;http://www.example.com/IdList/1/2.html?Id=1&amp;SubId=2&quot;. The Control Adapter solution presented by Scott does not do that.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if I didn&#8217;t pay attention or if something changed (I&#8217;ve cleared my browser cache and restarted IIS), but now your code doesn&#8217;t seem to work at all. I have:<br />
RewriteRule ^IdList/(\d*)/(\d*)\.html$ /Default.aspx?Id=$1&amp;SubId=$2</p>
<p>When I request <a href="http://www.example.com/IdList/1/2.html" rel="nofollow">http://www.example.com/IdList/1/2.html</a> I am indeed redirected to Default.aspx?Id=1&amp;SubId=2.<br />
With just the rewrite rule and without your code, the action attribute of the form tag contains &#8220;Default.aspx?Id=1&amp;SubId=2&#8243;. After adding your code it contains: &#8220;2.html?Id=1&amp;SubId=2&#8243;.</p>
<p>Although this does work, clicking a button on the form changes the url in the address bar to &#8220;http://www.example.com/IdList/1/2.html?Id=1&amp;SubId=2&#8243;. The Control Adapter solution presented by Scott does not do that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Nagtegaal</title>
		<link>http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback/comment-page-1#comment-290</link>
		<dc:creator>Dick Nagtegaal</dc:creator>
		<pubDate>Wed, 15 Jul 2009 09:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jlcoady.net/?p=10#comment-290</guid>
		<description>This code indeed is much simpler than using the Control Adapter approach. I have one problem with it however. When requesting the root of the application (i.e. www.example.com/) the value of HTTP_X_REWRITE_URL is &#039;/&#039;. For some reason this results in an &quot;Object reference not set to an instance of an object&quot; error.

The stack trace shows no source file, but it starts with:
[NullReferenceException: Object reference not set to an instance of an object.]
   System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +124

I&#039;ve tried adding a rewrite rule to explicitely rewrite / to /Default.aspx (Rewrite ^$ /Default.aspx) but that doesn&#039;t make a difference. Off course I can just check the originalUrl for being equal to &quot;/&quot; to prevent the problem.

Can you confirm this behaviour? Any idea why it is happening?
If you see the same behaviour, maybe you could adapt your code so it doesn&#039;t occur.</description>
		<content:encoded><![CDATA[<p>This code indeed is much simpler than using the Control Adapter approach. I have one problem with it however. When requesting the root of the application (i.e. <a href="http://www.example.com/" rel="nofollow">http://www.example.com/</a>) the value of HTTP_X_REWRITE_URL is &#8216;/&#8217;. For some reason this results in an &#8220;Object reference not set to an instance of an object&#8221; error.</p>
<p>The stack trace shows no source file, but it starts with:<br />
[NullReferenceException: Object reference not set to an instance of an object.]<br />
   System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +124</p>
<p>I&#8217;ve tried adding a rewrite rule to explicitely rewrite / to /Default.aspx (Rewrite ^$ /Default.aspx) but that doesn&#8217;t make a difference. Off course I can just check the originalUrl for being equal to &#8220;/&#8221; to prevent the problem.</p>
<p>Can you confirm this behaviour? Any idea why it is happening?<br />
If you see the same behaviour, maybe you could adapt your code so it doesn&#8217;t occur.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

