title: ASP.NET MVC Routing: How to make my MVC URL's have .aspx extension?
body: <p>I want an MVC app to have .aspx page URLs even though there will not be any physical aspx pages and I will be using the Razor view engine.</p>
  
  <p>1) Is it possible to define such a route?</p>
  
  <p>2) What would that route look like if I wanted a url such as, say, the one given below:</p>
  
  <pre><code>http://example.com/controller/action.aspx
  </code></pre>
  
  <p>and optionally</p>
  
  <pre><code>http://example.com/controller/action.aspx/id
  </code></pre>
  
  <p>and optionally</p>
  
  <p><code>http://example.com/controller/action.aspx?queryParam1=value&amp;queryParam2=value</code> (and so on...)</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I realize I want URL's like this:</p>
  
  <pre><code>http://example.com/controller/id.aspx
  </code></pre>
  
  <p>In other words, I want no specific action to be specified. A default action will process all requests.</p>
  
  <p><strong>ANOTHER UPDATE</strong></p>
  
  <p>What I have specified in my route config is this:</p>
  
  <pre><code>routes.MapRoute(
  name: "Default",
  url: "{controller}/{id}.aspx",
  defaults: new { controller = "Foo", action = "Index", id = "default" }
  );
  </code></pre>
  
  <p>However, while the above route does work for Url's where Id is specified such as the ones below:</p>
  
  <pre><code>http://example.com/foo/bar.aspx
  </code></pre>
  
  <p>It does not work when no Id is specified, such as in the case below:</p>
  
  <pre><code>http://example.com/foo/
  </code></pre>