title: Urlrewriting.net IsPostBack always false
body: <p>I am working on rewriting URLs Urlrewriting.net, and have run into what seems to be a common problem but I can seem to fix it. I'll present a simplified case.</p>
  
  <p>The URL rewriting is working perfectly with the rule:</p>
  
  <pre><code>&lt;urlrewritingnet rewriteOnlyVirtualUrls="true" defaultPage="default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07"&gt;
     &lt;rewrites&gt;
         &lt;add name="catalog" virtualUrl="^~/catalog/(.*)/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/catalog.aspx?cid=$1&amp;amp;c=$2" ignoreCase="true"/&gt;
     &lt;/rewrites&gt;
  &lt;/urlrewritingnet&gt;
  </code></pre>
  
  <p>On the page I have a DataList with 2 asp:buttons inside. When clicked, the page refreshes but does nothing.</p>
  
  <p>I followed <a href="http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx" rel="nofollow">ScottGu's article</a> to impliment a form control adapter to rewrite the action of the form to match the rewritten URL. </p>
  
  <p>Page URL in the browser: <code>http://...../dev/catalog/13/Music.aspx</code></p>
  
  <pre><code>&lt;form name="aspnetForm" method="post" action="/dev/catalog/13/Music.aspx" id="aspnetForm"&gt; 
  </code></pre>
  
  <p>I now see the correct URL on the form action, and when debugging I can see the page load event firing.</p>
  
  <p>The problem now is that every time the page loads Page.IsPostback is false, causing the page to rebind the DataList and therefore ignore the ItemCommand the buttons should be triggering. </p>
  
  <pre><code>if (!Page.IsPostBack)
       PopulateControls();
  </code></pre>
  
  <p>I'm using .NET 3.5 SP1, there is a ScriptManager on the master page but no UpdatePanel on this page. I've also tried resetting the Form.Action property and bypassing ScottGu's solution with the same result. If I go to the page URL directly without using the rewriter everything works fine.</p>
  
  <p>What am I missing?</p>