title: How to create a virtual subdomain in asp.net?
body: <p>I’ve wanted to use subdomains for sub-sites within a single application for a while now. Basically, instead of setting up multiple sub-sites like this…</p>
  
  <p><a href="http://example.com/shop1.aspx?name=john/" rel="nofollow noreferrer">http://example.com/shop1.aspx?name=john/</a></p>
  
  <p>…I wanted this…</p>
  
  <p><a href="http://john.example.com/" rel="nofollow noreferrer">http://john.example.com/</a></p>
  
  <p>I want dynamic subdomain virtually using URL rewrite 
  I have no idea how to do this. </p>
  
  <p>-----------UPDATE------</p>
  
  <p>After searching over the internet I got following code.it redirect perfect but not rewriting the URL</p>
  
  <p>my page is- <a href="http://domain/mySpace.aspx?una=sunil" rel="nofollow noreferrer">http://domain/mySpace.aspx?una=sunil</a></p>
  
  <pre><code>    &lt;rule name="Redirect to Subdomains" stopProcessing="true"&gt;
        &lt;match url="^mySpace.aspx$" /&gt;
        &lt;conditions&gt;
          &lt;add input="{QUERY_STRING}" pattern="^una=(.+)$" /&gt;
        &lt;/conditions&gt;
        &lt;action type="Rewrite" url="http://{C:1}.{HTTP_HOST}" 
          appendQueryString="false" /&gt;
      &lt;/rule&gt;
  </code></pre>
  
  <p>But still not able to resolve it.</p>