How to map a domain to another domain's subfolder? - asp.net

I have a very fast web server (IIS6, ASP.NET) that I want to use for several sites. Now, I already have a domain that maps directly to the IP address of the server, but how can I get another domain to map to a subfolder (i.e., a separate ASP.NET application) on that same computer? Is it theoretically possible? (note: only port 80 is open, I cannot open other ones.)
Accepted answer: shown below. I actually followed the tutorial and got it working. Hooray! Thanks, everyone! :)

Sure, you could do it with domain host headers. Just create a new web site and chose a different host header (e.g. www.example.com) and let it point to the desired folder. You can create hundreds of web sites on a single server, if you like.
Here is a tutorial how to do this.
Open IIS Manager
On the left side, expand your computer name, then click "Web Sites", right click in the right side, put your mouse over "New" and select "Web Site..."
Click Next in the dialog, then put in a description of the new web site you are creating (can be anything)
Click Next again and go to the last text box and put in what you want the new Host Header to be
Now put in the path to your new site and make sure you keep "Allow anonymous access" checked
Check "Run scripts" (for ASP.NET execution) if it's not already checked.
Click Finish on the next dialog and you're done!

Just create a new site in your "IIS Manager" application - the wizard will ask for the DNS hostname of the new site.
To see (or change) that value later, on the "Web Site" tab of the properties pages for that site, use the "Advanced..." options to chose which values for the HTTP/1.1 "Host:" header are used to get to that particular site.

Does it have to be a subfolder? You can setup a different site in iis and use host headers to direct each domain to the relevant site, all using one ip.
You can't do this if you need ssl though; you really need multiple ips for that.
If it has to be a subdir you can create another site as above and set it to redirect to somewhere else.

Related

Accessing a deployed website on IIS on a different machine on the network

I just deployed a website on IIS. After clicking on the browse button. The following url opened up
http://localhost:8080/
On IIS Manager this is what it looks like
Sites
|
|_Kites
|_aspnet_client
|_bin
|_...
My question is how do I access this website on a different computer now that it has been deployed on IIS
I tried this url.
http://10.xxx.xx.51:8080/
However when I try this url I get the error site cannot be reached.
Any suggestions on why this might be happening ?
This is what my bindings look like
Have you set Edit binding option in IIS server ? if not then do this.
You have to go to Edit binding option in IIS server and Add Site binding. their you have to choose your ip address and port as well.
Now you have to go to Windows Administrative tools and go to Windows firewall and advanced options then this window opens
Now go to Inbound Rules on the left corner then this window opens
Now click on New rule now this window opens
Now choose port and click next then this window opens
Now specify the same port as you have set on edit binding in IIS and click next then
Now, no need to change and option on this page and next page also just click next and then
Now enter the name of the rule and description and click finish...Its done.
You can access it on different computer...
Hope, this will help you.
If you find it helpful please mark my answer....Thanks

Multiple websites under a folder in IIS

I have a problem with websites in IIS.
The first thing that I did was that I set basic .html website in IIS under Default website (port 80). I moved the code in C:\inetpub\wwwroot\Test and it works.
When I type in the browser localhost/Test, it works but I have an ASP.NET Core web app and I want to open it using localhost/MyAspNetSite in the browser. Is this possible???
I'm asking that because when I right click on the Default website I have no possibility to add new website, only virtual directory or application. In my case, I put my .net code in C:\inetpub\wwwroot\New and in I added the new website on port 5000 and it works like localhost:5000 but not like localhost/New. I hope that you understand me.
Is it possible to have two websites on the same port or to connect two websites or something like that?
I am sending image about this problem. Thank you
You can host multiple sites under the same IP Address. In this case, the IP Address is called "Shared IP Address". This concept is used by all the shared host providers in this world.
That you basically need to do is to go to your IIS -> click your domain -> Bindings -> and add "www.yourDomain.com" and "YourDomain.com" to the IP. If you have a second site, you just have to do exactly the same thing, you can check this blog post it can help u to understand all that things
http://woshub.com/run-multiple-websites-on-the-same-port-and-ip-address-on-iis/

configuring asp.net website on iis on windows 7

I have website and I configured it on IIS. I did not supply any ip and let the default be stayed "All unassigned".
When I browse the site from IIS manager it's give error in browser that "The resource cannot be found" and the url is 'loclhost/MAIN.aspx"
My application name is rentalone but the url does not include the app name. It just gives the page name and localhost.
What am I doing wrong.
Please help
thanks
Go into IIS, expand the tree in the left side, you should see a Default Web Site eventually in the tree. Right click that and select Add Application, it will ask you for a Name and location, location is there you application files are and Name whatever you like. When that is done, you can go to http://localhost/MyAppName/main.aspx
MyAppName being the name you provided it

Umbraco configured with IIS 7 having hard time with the site URL?

I am having a problem with my Umbraco installation on IIS. The site is working, apart from my home button. When I push the home button, the URL should be
http:/myserver.mysite
instead the URL is
http:/myserver
When I type in the link it serves me the home page but when I click on the Home button it wont and the scenario described above occurs.
I am using IIS 7 and Umbraco 6.1.1.
If you are able to get to the homepage with both hostnames but then clicking on the Home link takes you to the second host, the link in the page must be referencing the hostname directly. If this is the case, check your HTML to ensure that the hostname isn't present in the link - basic I know but you have to check.
If it isn't, contrary to what Eric Herlitz says in his answer, I would ensure that you don't have anything set in the hostnames options. I only use the hostnames option when I need to control the hostnames of multiple root nodes. Umbraco will automatically assume that the first node in the tree is the default site. In other words, if you have two sites at the root of your Umbraco instance but only one hostname bound in IIS, Umbraco will serve the first of the branches as the default site, unless as Eric Herlitz states, you have specified the hostnames for specific nodes.
Instead, I would use the settings in IIS to ensure that requests are routed to the correct hostname. I know using Eric's approach is possibly easier, but it would undoubtedly mean that users will still be able to reach and browse the site using both hostnames. Ultimately from an SEO perspective this is a bad thing. Personally, I would ensure that any requests to anything but your preferred hostname are redirected to you hostname whilst retaining the path. This can be done via IIS using the UrlRewrite 2 module.
If you don't have access to this, you can use MVC routing (see here for an explanation) or the UrlRewriting module that comes shipped with Umbraco. With the latter, settings are specified in the ~/config/UrlRewriting.config file and documentation can be found here: http://www.urlrewriting.net/149/en/home.html
I would personally recommend familiarising yourself with all these techniques as they can be quite powerful.
Did you set your hostname in Umbraco?
Right click on the site root in your solution and click "Culture and hostnames"
Fill out your hostnames and save

deploy asp.net project on another computer

Just to begin I am a beginner in ASP, and havign some difficulty in deploying my first application.
I made a asp.net project in VS2008, and I ws trying to deploy it on another machine and following are the steps that I did:
right clicked on website and published set loaction to c:\inetpub\wwwroot and pasted my app to this folder.
Then I went to control Panel- admin tool- IIS and there it showed the website which I copied then went to its properties added documents, set ASP>NET version, it was blank by default. Then edited the configuration and under authentication changed its mode to none.
And then when I cick on the app in IIS and browse it showed the desired output, but I need to know how to open the same app in browser.
Thanks
If I've understood this correctly - it does depend on how the website has been set up in IIS. At it's most simple it would be
As the default website
http://[external IP of webserver]/default.aspx
As a virtual under the website
http://[external IP of webserver]/[virtualName]/default.aspx
Assuming there is a file called default.aspx (insert your own)
if default.aspx is specified as a default document for the site
http://[external IP of webserver]
http://[external IP of webserver]/[virtualName]
if you are using binding to a specific IP and or port (look in IIS, left handside at the binding link - see image below)
http://hostname: optionalpost
Apologies if I have misunderstood
EDIT
To check whether the site is active at all and to get a better idea of what the external URL is then on the left hand side of IIS will be browse to website. Click this to check whether the site comes up at all.
If it does then the URL should be obvious. It could be one with a host header i.e. looks like a normal URL i.e.
http://mytestsite.com
If it is in this format then you may not be able to browse externally if you can't resolve this hostheader to the IP of the box. To get around this then edit you host file and add a mapping from the url to the external IP of the box.
Host header is at following in windows 7 (or windows generally i think)
C:\Windows\System32\drivers\etc\hosts
Please back this file up before editing it

Resources