title: Working with URL rewrites
body: <p>I'm trying to play around with <a href="http://en.wikipedia.org/wiki/Rewrite_engine" rel="nofollow noreferrer">URL rewrites</a> and can't get it to work.</p>
  
  <ol>
  <li><p>I have a URL, <code>http://localhost/CToastWebsite/Rooms.aspx</code> and want to write it as <code>http://localhost/CToastWebsite/Rooms</code></p></li>
  <li><p>And I have another URL, <code>http://localhost/CToastWebsite/Rooms.aspx?type=CreateRoom</code> and want to write it <code>http://localhost/CToastWebsite/Rooms/CreateRoom</code>.</p></li>
  </ol>
  
  <p>How would I go about doing this? </p>
  
  <p>I have tried and my CSS and images do not work even though I use <code>/styles/styles.css</code> with URL <code>http://localhost/CToastWebsite/Rooms.aspx/CreateRooms</code>. Is this the correct way of using a URL like this?</p>
  
  <p>I'm stuck, and I have searched for articles, but I can't find anything that is easy to follow and get the CSS and images to work.</p>
  
  <h2>EDIT</h2>
  
  <p>I have set up <code>urlrewritingnet.net</code>, but I am having problems. I set a rule such as:</p>
  
  <pre><code>&lt;urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07" &gt;
  &lt;rewrites&gt;
  
    &lt;add name="Rewrite"  virtualUrl="^~/Rooms"
         rewriteUrlParameter="ExcludeFromClientQueryString"
         destinationUrl="~/Rooms.aspx"
         ignoreCase="true" /&gt;
  
  &lt;/rewrites&gt;
  
  &lt;/urlrewritingnet&gt;
  </code></pre>
  
  <p>So I want <code>/rooms.aspx</code> to change to <code>/rooms</code>, but the page keeps displaying <code>/rooms.aspx</code>.</p>
  
  <p>Session state error now</p>
  
  <blockquote>
    <p>Session state can only be used when enableSessionState is set to true, either in a        configuration file or in the Page directive. Please also make sure that     System.Web.SessionStateModule or a custom session state module is included in the     \\ section in the application configuration.</p>
  </blockquote>
  
  <p>I have added the tag in the <code>web.config</code> file in &lt;system.web>:</p>
  
  <pre><code>&lt;sessionState mode="InProc" timeout="20" cookieless="UseCookies" /&gt;
  </code></pre>
  
  <p>and I have set <code>EnableSessionState="true"</code> in the page directive.</p>
  
  <p></p>
  
  <h3>Solution</h3>
  
  <p>I followed Stack Overflow question <em><a href="https://stackoverflow.com/questions/2757403">Error using session in IIS 7</a></em> to make the session state work again.</p>