Asp.Net Tutorial : What is localhost?

Leave a Comment

Let us first see, what we mean by a hostname. Whenever you connect to a remote computer using it’s URL, you are in effect calling it by its hostname. For example, when you type in
http://www.google.com/

you are really asking the network to connect to a computer named www.google.com. It is called the “hostname” of that computer. localhost is a special hostname. It always references your own machine. So what you just did, was to try to access a webpage on your own machine (which is what you wanted to do anyway.) For testing all your pages, you will need to use localhost as the hostname. By the way, there is also a special IP address associated with localhost, that is
127.0.0.1

So you could as well have typed:
http://127.0.0.1/

and would have received the same page.

To access pages in a virtual directory called myscripts for example, you should type in:
http://localhost/myscripts/

in the address bar. I hope the concept is now clear …

0 comments:

Post a Comment