get hostname of remote clients accessing my website using vb.net - vb.net

I have a Vb.net based website which is a pretty old one can't upgrade it.
I need the hostname of the clients visiting the website.
On page load of the login page I am calling using this which gets me the client's hostname who's accessing the website.
System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST")).HostName
I am logging the details into my Database which is similar to the below
172.xx.xx.xx ltp-017 RUPESH
I have no problem catching the IP address and hostname of devices accessing my website from home network but when a device(including mobile devices) is accessing from outside my home network the above code does not catch the hostname.
Is there any other option or programming language which I can use inside my VB.Net to achieve this?
Any ideas to get this work is much appreciated.
Thanks for your time in advance.

Request.UserHostAddress gives the IP of the connected remote client.
https://learn.microsoft.com/en-us/dotnet/api/system.web.httprequest.userhostaddress?view=netframework-4.7.2

Related

Can't access my website after trying to move it to another server

I want to move my website to my new virtual server that I bought from another service provider.
I installed Apache Webserver, created a virtuzal host for the website and I changed the DNS in my actual service provider's admin panel pointing to the new server's IP address.
I then realized that I can't access mysql to export my database and I disabled the domain on the new server, changed the DNS back in my old admin, but now I get a ERR_CONNECTION_REFUSED when I try to call the website.
I don't find anything on Google, because everybody wants me to delete browser cookies (which I did), but that doesn't help.
What can I do for getting back the old website and being able to export my MySQL database?
It may well be that your DNS records are still propagating and you need to wait. Try adding an entry in your hosts file to point to the "old" site URL and hit it in your browser. If it works then it's the DNS not completed propagating. Otherwise your error looks like an Apache issue not a MySQL issue.
I simply deleted the virtual host on the new server for the domain and I was able to access the "old" site immediately.
It's still possible, that the DNS just finished propagating, like #George said, but it's very unlikely.

How does smackaho.st work?

It basically sends everything you throw at it to your localhost. Is it possible to do this with apache server and .htaccess? Its also what I used as a callback url when I was developing using twitter's API. So I'm curious. http://smackaho.st
Thanks
There is no HTTP server involved here at all. The DNS A record for smackaho.st is 127.0.0.1, which refers to your own machine.
Using that name as a "callback url" probably won't work at all, since when Twitter tries to contact smackaho.st, they'll get 127.0.0.1, which refers to their own machine (not yours).

Web-page redirection

I am trying to achieve the following:
when a user types "print" (or "http://print") in the address-bar of the browser :
I want the user to be re-directed to a page : www.abc.com/print/
How can one achieve this ? I tried to lookup some squid configurations but was unable to find the same.
Thanks!
Edit : I do not understand the deal with down votes, this is a perfectly valid question.
If you want to enable a user on your LAN to type "print" in the address bar and be redirected to a given hostname, you'll have to supply a DNS record to that effect. This is not accomplished on a web server, nor is it web development in any respect.
There are several methods to resolving a given hostname to a given IP or to another hostname. One way is to edit the client hosts file, as described in another answer. One could also, if you have a DNS server running within your LAN environment, add A records to this effect.
You must understand how hostname lookups work from a browser. When you type something in the address bar, your browser uses your operating system to resolve the hostname to an IP address. Your operating system uses its hosts file, internet connection, and other mechanisms to accomplish this. This process itself has several tiers and steps that are outside the scope of the browser and which cannot be influenced by the browser. Nor will arbitrary web servers be consulted in this process. Your aim is to inject something in this process that resolves the hostname "print" to the webserver of your choosing - THEN web development might come in to play.
See: http://www.quackit.com/how-websites-work/how-dns-works.cfm

Browsing sites with their domain name from the same server they are hosted on

I have a co-located webserver(Win2k8) having a public IP and have hosted my ASP.NET website on the IIS. Though, I am able to browse everything else from the local browser(IE) installed on the server, the server somehow fails to browse the websites that are hosted in its own IIS when I access them using their 'domain name' set as a host header. For e.g: If the website is for "www.mywebsite.com", so naturally I have set the Host header property to "www.mywebsite.com" and when I put "www.mywebsite.com" in my IE address bar it fails to get the request.
Ok, so now why I need to access this website is that, I plan to send a Query parameter to one of the pages from another page of the same website.
Any idea how to get this working? Thanks in advance folks.
It may be trying to reach itself via its public IP address, which it may not be able to route to.
You can try adding a line into your hosts file (C:\Windows\System32\Drivers\Etc\Hosts, or equivalent) as follows:
127.0.0.1 www.mywebsite.com
Which will force it to access it via the loopback adapter.

multiple request from same ip on Server logs

I implemented a client side interface which makes a service call to the server using JS in an http GET. When checking my access logs, I see that sometimes, I get multiple requests sometimes as many as 6 within a second-- Making the very same request-- from the same ip -- what do u think this tells ?
Thanks
It might tell they're behind a proxy. (the IP you see is actually the proxy's IP)
It could be 6 different computers behind one router, all visiting your page. Or 6 tabs on one browser of one computer. Or a bug in your JavaScript?