• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3202
  • Last Modified:

Difference between GetObject("IIS://localhost/W3SVC/1/ROOT") & GetObject("IIS://" & computername & "/W3SVC/1/ROOT")

Hi, what is the different between  GetObject("IIS://localhost/W3SVC/1/ROOT") and GetObject("IIS://" & computername & "/W3SVC/1/ROOT") , when I have to use localhost and when I have to use computername? and is there another parameter other than these two parameters?

2 Solutions
Well, I'm not 100% sure, but as far as I know, EVERY computer can reference ITSELF by localhost. (Well, I mean every computer which runs IIS indeed.) But that same computer may have a different name as well. Suppose that you are on a machine which is also named comp1.domain.com ; now it can reference itself by localhost, but OTHER machines of the same domain should reference it by its full name.
Hope it helps
Localhost is best used when the code is running on the machine itself, while computername should ONLY be used when you are trying to connect to another pc. The advantages of localhost are quite obvious. If the computer changes name, changes domain, changes ip it will not affect your code. Localhost will always return the pc the code is running on.

As far as executing time etcetera is concerned I think localhost is a bit faster then computername, but the speed difference is neglectable.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now