How to stop redirect to default website when IP address is entered in the address bar of the browser? - asp.net

I have multiple websites hosted on our server. When someone types the IP address in the address bar of the Browser It redirects to one of the websites hosted on the server. Is there any way by which I can set the default website which is opened when some one types the IP address. Same IP address is being shared by multiple websites.

1 IP address can only bind to 1 IIS Entry. So what you need to do is to pick the IIS entry you want, go the "Binding" section and bind your IP as the binding header.
ex: If your IP is 1.1.1.1 , then in binding header, you put 1.1.1.1, in IP address, you also choose 1.1.1.1.
After you setup this binding, you can browse to 1.1.1.1 and it'll open your site.
Remember to make sure all other sites doesn't have this binding. Otherwise, it'll have an conflict.

All you have to do is leave off the IP address and host name entries, and provided you have only a single website matching that, that site will become the 'default', while your other sites will have specific host name(s) they respond to.

I am not sure, but you may have to add a specific host in the C:\\Windows\System32\drivers\etc\hosts file, giving IP address and its corresponding address, this definitely works from logging into the website where it is hosted, i.e on the hosting server.
For logging from different IP machines, try the same logic - in this case make sure that the gateway is same for LAN.
Let's see what happens in this case ??

Related

Block access to website from router(using its IP adress)

I'm trying to block access to a website (e.g site.com), to do so I used dig site.com to get the site's IP adress (I'm on Ubuntu). The result will be something like this:
site.com. 10000 IN A 101.53.182.181`
Then mapped new IP ( localhost ) to the domain name 'site.com' on /etc/hosts, as the following:
127.0.0.1 site.com
That will do the thing for my local machine, but not for the whole network's devices.
Also tried to configure from the router using telnet 192.168.1.1 but I lost it, I don't know how to do it.
How can I manage to block traffic from that particular site? Is there anyway to block access to websites using their IP address?
PS: I tried the classic way to block the site using its domain name (e.g site.com), but it doesn't really 'block the site', I can still access it by searching the website on Google.
You can try accessing your router's web interface. Make sure to set your computer's (laptop's) IP address manually to 192.168.1.2, subnet mask to 255.255.255.0 and then gateway to 192.168.1.1 for the computer's Eth0 interface. I suggest to use the wired interface instead of WLAN or WiFi. Then, access the router on a web browser using 192.168.1.1.
In your router's settings page, look for the following:
Block Sites
Access Restrictions
Security
Advanced
or something similar to the mentioned categories above. This may depend on the settings, so I advise to refer to your router's manual. Once you find the setting, indicate the domain/s or IP address (via dig) that you want to block, then apply the settings or changes that you have made.

Why does the user's IP is a local one when accessing the page using the global URL?

I am logging every user's IP when they access the company's page.
There are two ways to access the page from inside the local network:
http://company/webpage
and
https://webpage.company.com
What bugs me is that even when the users use the https global IP, their accesses are still recorded on database with their IP as 10.50.1.12 or 10.50.1.100.
Does that means that the browser or something else is redirecting the https://webpage.company.com to company/webpage? Or does that mean that I'm using a flawed method to log the users IP?
Another way to ask my question (just to make sure I'm being clear): if I'm accessing my Internet web page from inside the LAN network, am I effectively going outside my network and then back? If not, where am I going wrong with my logging?
Code used to log user's IP:
user.LastIP = HttpContext.Current.Request.UserHostAddress;
I'm curious about this because I want to make sure the users inside the company will access the page using exclusively the LAN Network. The goal is to save bandwidth usage, which is scarce.
Edit:
Pinging the https://webpage.company.com from inside the LAN network will result in a reply from a global IP address like 194.xxx.xxx.xxx. So I'm clearly getting the user's IP wrongly. What would be the ideal way of retrieving the IP from the page accessing entity?
Access to http://company/webpage will result in a DNS lookup of the host name "company". To resolve this, DNS will need a fully qualified domain name (fqdn), so it will add a top level domain (according to the configured search list in the client). In this example, it seems fair to assume that the fqdn will be "company.com". This, in turn, may very well resolve to the same IP address as the "webpage.company.com". You can check this by using dns lookup utilities like 'nslookup' and 'dig', or simply by using 'ping company' and 'ping webpage.company.com'.
The users IP addresses you mention, 10.50.1.12 and 10.50.1.100, seems to be the local IP addresses of the client hosts. I base this assumption on the fact that these IP addresses come from the RFC-1918 address range which is used for internal addresses. My guess is that these are the correct IP addresses, and that your logging works fine.
The users IP address you will log from accessing 'http://company/webpage' and 'https://webpage.company.com' should in most cases be the same. You can see it this way: it doesn't matter what the target URL is, traffic is still coming from the same host, the same IP address.
In any case, you most probably don't need to worry about any traffic leaving your local network.

Hosting multiple sites on IIS having same the IP address

I need to host multiple sites for testing on single server with one IP Address over IIS.
Currently i have hosted a website which is mapped directly to IP address means no domain name. i need to host another website on same IP. How can i achieve that? is this possible having
e.g 174.22.12.87 (Site1)
e.g 174.22.12.87 :800 (Site2)
I am confused what to put in Host Name and Site Name ? for single IP Address and to host multiple sites. If i put ip in host name in both websites that look fine but what to put in site names? i think they should be unique?
you can have a look at this link.
https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b77cf015-017f-489c-9b5b-65ca4a679392.mspx?mfr=true
If you have the same IP-Address, the port is used used to host multiply sites. So you are right.
The combination of IP, Port, and HostName must be unique.
If you're deciding to always leave HostName blank (referencing things by IP:Port instead of domain) then you still just need the combination of IP and Port to be unique. (i.e. 174.22.12.87:80 vs 174.22.12.87:800)
I believe you're using SiteName to mean the IIS site name, which is just what it shows as within IIS and doesn't impact how you access the site at all.
Don't forget to add new Inbound rule to open your specified port in Windows firewall (server side).

IIS 7 IP Addresses and Domain Restrictions - denying all

This evening I noticed a brute force attack attempt from the same IP address on several of our websites hosted on the same IP address. The attempt was to exploit a bunch of php-related vulnerabilities.
As I get notifications on all of these, I simply added the incoming IP address in IIS Manager/IP Address and Domain Restrictions - set to deny, then left it.
No more notifications, so I figured everything was good.
Later when I attempted to access any of our websites, I got a 403 access denied error from any IP address I tried to access these sites from. I do have one site that I have explicit allow rules set for other IP addresses, which I was able to access, however all the other sites do not have this special rule.
To get all the sites working again, I added an Allow rule where I added an IP address range is the web server's IP address, and Mask or Prefix = "(1)".
Here are the settings in IP Address and Domain Restrictions:
Mode: Allow
Requestor: ([my server's IP address])(1)
Entry Type: Local
So what I'd like to know is why this is now allowing access to the rest of my sites. Did I mistakenly delete a value that should have been there before?
From what I read here, By default, domain name restrictions are disabled.

How to view a web page served from one computer from another computer

I am running a website from IIS on one computer and I want to view the web page on another computer. the only way I can do this is by using the ipaddress of the computer with IIS on it but would rather have a url. How can I generate a url or use a domain name from dynamicdns.com. I signed up for an account on that website but dont know how to use it. I dont know how to configure it.
If the computers are in the same LAN you can substitute the computer's name for the IP. If you want the website to be visible outside the LAN, and accessible according to your dynamicdns.com name, you'll probably have to set up port forwarding on your router so that requests for port 80 are sent to the IP address of your IIS server.
edit your hosts file under Windows/system32/drivers/etc
add the ip and any hostname you want to use, e.g.
74.125.19.103 my.hostname.com

Resources