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

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 127.0.0.1 via IIS and then putting username.site.com in the hosts file to point to 127.0.0.1 - but it does not work out.
The website loads up - but the querystring is not generated.
Also tried putting just site.com -> 127.0.0.1 in the hosts file and accessing username.site.com. But in this case, the website does not load (site not found)
Any ideas?

easy way to test this will be to edit your hosts file so that username.site.com points to 127.0.0.1, but you will have to do this for each user you want to test on each PC...

Okay.
I managed to get this working. Its simple if you think about it.
I got myself a DNS server, installed it on my system and configured it to serve me pages from 127.0.0.1 for site.com
If you are wondering, I used a DNS server called SimpleDNS from http://www.simpledns.com/
There is also a free BIND DNS server available from:
http://oldwww.isc.org/sw/bind/view/?release=9.6.1b1&noframes=1
But that was too much for me to configure at this point of time.

Related

Host ASP.Net MVC Site

I've created a site using ASP.Net MVC that is meant to be stored on a local machine at my place of work. The intention is to have the site stored on this machine, but then accessible by all the other machines within this building.
I've followed Microsoft's tutorial as well as Code Project's tutorial, but I am not having very much luck. The binding is just the localhost, port 80, with * for the IP address. The URL is localhost/GrantTracker.
I've opened the ports within the firewall, checked the permissions on the directory (which is just within wwwroot), tried having the site take the place of the default IIS site (as Microsoft tutorial has you do) and tried having the site stand on its own with its own port (per Code Projects tutorial).
On the host machine I am receiving the standard "This site can't be reached, localhost refused to connect" which feels like either a port or permissions problem. I must be missing a step, but I can't seem to find what it would be. I am new to hosting sites through IIS so forgive me if I am just missing something basic.
I find it a bit strange too because my project uses Windows Authentication and when the site is first visited it performs that initial check with the user, authenticates, but then throws me the error.
Anyone have any ideas? Thanks in advance.
start simple,
create a simple html page, create an IIS application for it, on port 80.
Check and make sure you can see that page from another computer using the internal IP address of the the host machine so something like:
http:\\192.168.0.3\hostapp\test.html .
You can see the proper URL by running it from IIS, this will give you the entire URL you need, with localhost then just replace localhost with the IP address of the host machine to see it on other machines.
Do this in the original IIS folder so you don't encounter any folder permission issues. If you choose another folder you'll have to give access to the Network Service user ( i think, can't remember now, but there is a specific user that needs access to the folder where the website is deployed )
if you can see the page then deploy a proper website and do the same thing. Make sure the app pool is created correctly and it's up and running, then access it again on other computers and it should work.
Port 80 should be open by default so that should not be an issue.

Applying SSL on the localhost

I am applying SSL in my sample web application using self signed certificate. The purpose is to test the session availability when I go from http to https or the other way round.
My localhost address is localhost:5366. I have done these as follows:
I have added a website in IIS. But confused that when binding using http, I give port 5366. I works fine but when I remove it and apply https, port 5366. The page doesnot load.
So, what should I do to accomplish this?
Its a bit confusing, but if i can bet, you are interchanging the debug mode from VS and the published site, correct me if am wrong.
I configured my https site in this way:
Configure your IIS to accept https through port 443.
Set the website file system place to a certain folder
Publish your website with VS to this folder
Reach it through https://localhost
Hope it works!
My project was not residing in the iis physical path. Therefore, it was not loading my desired pages. Thank you guys.

IIS7 and Classic ASP and Applications and Paths

I yesterday received a zip file containing an old asp site from 2005. Its came in a folder called ivx.
I've unzipped ivx to c:\inetpub\wwwroot and then created an application in IIS called ivxapp and pointed it to c:\inetpub\wwwroot\ivx. Now when I type http://localhost/ivxapp, I am able to access the index page.
My problem is, whoever designed that site, designed it when IIS5 or IIS6 was around. He's used paths like more... which leads to http://localhost/new_posts.asp and not http://localhost/imagevertex/new_posts.asp
The whole site is some 21000 lines of code and contains many many references like this. Then comes the problem with <!--#include virtual = "/common/adminverify.asp" -->
Instead of having to manually edit the entire code, do you know a way to get things going?
This site worked perfectly well on a production server. Right now it's on my local machine on Windows 7 64 home premium.
Yes, you need to give this site a root-URL of its own, and not run it in a subdirectory of your localhost.
This is more of a web-administration question, but what you need to do is either run it under "localhost" directly, or add a domain-name to your network to run this site under.
The easiest for you right now is probably the first option.
If you aren't running a different site under localhost already:
Go to the IIS manager and click the 'localhost' site. On the right side of the IIS interface you can change the basic settings. Point the physical path to the ivx directory. You can reach the site directly on http://localhost.
If you are already running a site under localhost you need to keep:
Now, if you -are- already running a site on your localhost, the second easiest option is to run the ivx site under localhost, but on a different port. To accomplish that, click on the current ivx site in IIS, change the path in the same way as descibed above, and after that click on "bindings" in IIS, and change the PORT for the ivx site to something other than 80, for example 81.
The ivx site will then run on http://localhost:81, your current localhost will still run on http://localhost.
The hard way: adding a host to your network or PC:
The last option is to add a new hostname for the site to your network. You can add an A-record in your DNS for the ip-address of your server or add a host name to your HOSTS file in Windows on your server ("server" in the sense of the machine that runs the site, which can also be your local machine)
You can add a made-up name to the ip-address of the server, and in IIS' bindings add that name under "host name". this way you can run two different sites on the same machine, the "host name" seeting in IIS will make sure that calls to that specific hostname will reach the correct site. Adding it to the DNS of your network, or the HOST file in Windows will make sure the name is resolved to the correct machine (your webserver).
This last option is a little tricky of you've never done something like this before, but the first option works just as well.
Good luck!
Erik

imitate iframe coming from another domain

I am trying to develop a small web application which will consist of one web applicaiton using an iframe from another domain. I am trying to test this on my local machine, and for this I need to imitate as if the iframe is coming from another domain (while it's actually on the same domin as the other web application - my computer). Can this be done? If so, how?
Thank you
Test it through a local http server (just in case your were accesing to the local files).
Define 2 different vhosts in your http server.
Edit your etc/hosts file to add:
127.0.0.1 domain1.com
127.0.0.1 domain2.com
So now you have 2 different sites, but running on the same computer.

What do I need to publish my ASP.Net application to a URL locally?

I don't want to pay for a domain, but simulate a url exists, something like 'www.myapplication.app'. Is this possible?
I'm guessing I need to configure some thing with IIS7 or something right?
This is for a college course and instead of just doing the bare minimum I'd like to make something very nice to show.
I realize this question might be broad but any links would be great. :) Especially if it starts from the beginning of IIS configuration.
My ultimate plan is to have a Windows Server 2008 on a Virtual Machine and publish it there, is it possible?
c:\windows\system32\drivers\etc\hosts
In this file you can mimic domains, for example you would put:
127.0.0.1 www.myapplication.com
Where 127.0.0.1 is always referring to you locally (== localhost)
Added obvious step:
You then create an application in IIS where you use this domain in the HostName of the application. You then can acccess your own domain from your browser.

Resources