Local testing for sub-domains using Url rewriter, Asp.Net 2

I am using UrlRewriting.Net for url rewriting in Asp.Net 2 and IIS 5.1 (offline) and IIS 6 (online)

The application performs the following:

A url of the following nature: http://username.site.com is re-written as http://site.com/Default.aspx?user=username

This works perfectly online. However, I would like to know how we could test this offline.

I have tried pointing the application to via IIS and then putting username.site.com in the hosts file to point to - but it does not work out.

The website loads up - but the querystring is not generated.

Also tried putting just site.com -> in the hosts file and accessing username.site.com. But in this case, the website does not load (site not found)

Any ideas?
Who is Participating?
cj_1969Connect With a Mentor Commented:
You could try running a DNS server on your workstation.
https://www.isc.org/software/bind ... there is one for Windows
If you do this, you can create a new dummy domain to test with.  Configure the hosts that you want to test with in the new domain and then just set the forwarder in the DNS service to your real DNS server and all other domains should resolve as normal.

If this is a DNS issue and the applications interaction with the name then this should resolve the problem.
each is a unique host name ... try entering both into the hosts file pointing to the same IP.
sajain84Author Commented:
Thank you for your inputs.

I've done exactly that.
My host file is as below:

Even with this, it does not work.    localhost    mysite.com    blah.mysite.com

Open in new window

sajain84Author Commented:
Awesome! It worked.
However, I used another DNS Server as BIND was too much to configure.

I got SimpleDNS from: http://www.simpledns.com/
Thats a 14 day trial but a lot more time than I need.

Thanks again!
All Courses

From novice to tech pro — start learning today.