Hi,

I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?

Thanks

Christoph

Re: connecting to localhost by Ray

Ray
Fri Jul 08 09:59:20 CDT 2005

What do you mean, it can't see itself? Is this a DNS name resolution issue?
That's my guess. Ask your host if the server is able to resolve dns names,
and if not, if it's possible to make it so that it can. Since the server is
using host headers, you will have to make the http request to your site by
one of the recognized host header names. If the server doesn't have any DNS
server setting, this won't be possible, afaIk.

Ray at work

"Christoph Lutz" <CLutz@gmx.net> wrote in message
news:42ce8dd3$0$6282$ed2619ec@ptn-nntp-reader03.plus.net...
> Hi,
>
> I have got a scenario where an asp script needs to request via xmlhttp a
> file sitting on the same server. The code all works find on my local
> machine. However, on the hosting server, it does not. The problem is
> that I am on a shared server and the server can't "see itself", i.e.
> it's probably blocked by the host to receive request from itself. The
> problems comes in as the server will hold multiple sites and use host
> headers to channel request. I thought of using "localhost" and some kind
> of header sending scenario to get the server to go to the correct
> subfolder/virtual host. However, googling has not brought up much. Has
> anyone got ideas/similar scenarios and could point me in some helpful
> directions?
>
> Thanks
>
> Christoph



Re: connecting to localhost by Christoph

Christoph
Fri Jul 08 11:27:27 CDT 2005

Ray,

The server can't resolve DNS - even if it could, there would most likely
be firewall and NAT issues, so the only reliable way is to connect to
localhost and then send the appropriate headers. I am looking at opening
sockets and sending appropriate headers - or indeed any other way that
achieves the same by using localhost is what I need. Anyone?

Christoph

Ray Costanzo [MVP] wrote:
> What do you mean, it can't see itself? Is this a DNS name resolution issue?
> That's my guess. Ask your host if the server is able to resolve dns names,
> and if not, if it's possible to make it so that it can. Since the server is
> using host headers, you will have to make the http request to your site by
> one of the recognized host header names. If the server doesn't have any DNS
> server setting, this won't be possible, afaIk.
>
> Ray at work
>
> "Christoph Lutz" <CLutz@gmx.net> wrote in message
> news:42ce8dd3$0$6282$ed2619ec@ptn-nntp-reader03.plus.net...
>
>>Hi,
>>
>>I have got a scenario where an asp script needs to request via xmlhttp a
>>file sitting on the same server. The code all works find on my local
>>machine. However, on the hosting server, it does not. The problem is
>>that I am on a shared server and the server can't "see itself", i.e.
>>it's probably blocked by the host to receive request from itself. The
>>problems comes in as the server will hold multiple sites and use host
>>headers to channel request. I thought of using "localhost" and some kind
>>of header sending scenario to get the server to go to the correct
>>subfolder/virtual host. However, googling has not brought up much. Has
>>anyone got ideas/similar scenarios and could point me in some helpful
>>directions?
>>
>>Thanks
>>
>>Christoph
>
>
>

Re: connecting to localhost by Aaron

Aaron
Fri Jul 08 11:42:16 CDT 2005

> The server can't resolve DNS - even if it could, there would most likely
> be firewall and NAT issues, so the only reliable way is to connect to
> localhost and then send the appropriate headers. I am looking at opening
> sockets and sending appropriate headers - or indeed any other way that
> achieves the same by using localhost is what I need. Anyone?

You will need to ask the host how to access your virtual directory /
application by IP/localhost. Usually (but not always) there is a way to get
at each directory without using the host header, e.g.
http://localhost/applications/yourcompany/ instead of
http://www.yourcompany.com/ Again, usually, but not always.

Or, look at a different way to grab the results of the file you are calling.
Can't you replicate its functionality in the current page so that an HTTP
request is not required?

A



Re: connecting to localhost by Ray

Ray
Fri Jul 08 12:17:13 CDT 2005

If this server were sitting next to you, another option would be to put an
entry in the HOSTS file (typically in %windir%\system32\drivers\etc) that
resoluves to 127.0.0.1, but has a name other than localhost. Then you'd add
that name as another host header for your site. Is this an option?

Ray at work

"Christoph Lutz" <CLutz@gmx.net> wrote in message
news:42cea970$0$6291$ed2619ec@ptn-nntp-reader03.plus.net...
> Ray,
>
> The server can't resolve DNS - even if it could, there would most likely
> be firewall and NAT issues, so the only reliable way is to connect to
> localhost and then send the appropriate headers. I am looking at opening
> sockets and sending appropriate headers - or indeed any other way that
> achieves the same by using localhost is what I need. Anyone?
>
> Christoph
>
> Ray Costanzo [MVP] wrote:
> > What do you mean, it can't see itself? Is this a DNS name resolution
issue?
> > That's my guess. Ask your host if the server is able to resolve dns
names,
> > and if not, if it's possible to make it so that it can. Since the
server is
> > using host headers, you will have to make the http request to your site
by
> > one of the recognized host header names. If the server doesn't have any
DNS
> > server setting, this won't be possible, afaIk.
> >
> > Ray at work
> >
> > "Christoph Lutz" <CLutz@gmx.net> wrote in message
> > news:42ce8dd3$0$6282$ed2619ec@ptn-nntp-reader03.plus.net...
> >
> >>Hi,
> >>
> >>I have got a scenario where an asp script needs to request via xmlhttp a
> >>file sitting on the same server. The code all works find on my local
> >>machine. However, on the hosting server, it does not. The problem is
> >>that I am on a shared server and the server can't "see itself", i.e.
> >>it's probably blocked by the host to receive request from itself. The
> >>problems comes in as the server will hold multiple sites and use host
> >>headers to channel request. I thought of using "localhost" and some kind
> >>of header sending scenario to get the server to go to the correct
> >>subfolder/virtual host. However, googling has not brought up much. Has
> >>anyone got ideas/similar scenarios and could point me in some helpful
> >>directions?
> >>
> >>Thanks
> >>
> >>Christoph
> >
> >
> >



Re: connecting to localhost by Christoph

Christoph
Sat Jul 09 02:32:35 CDT 2005

Hi Aaron,

Thanks for your reply. Accessing via your other method might be an
option. I will need to investigate - but as you say, it's not always the
case and I am really looking for a universal option. Thank you,though

Christoph

Aaron Bertrand [SQL Server MVP] wrote:
>>The server can't resolve DNS - even if it could, there would most likely
>>be firewall and NAT issues, so the only reliable way is to connect to
>>localhost and then send the appropriate headers. I am looking at opening
>>sockets and sending appropriate headers - or indeed any other way that
>>achieves the same by using localhost is what I need. Anyone?
>
>
> You will need to ask the host how to access your virtual directory /
> application by IP/localhost. Usually (but not always) there is a way to get
> at each directory without using the host header, e.g.
> http://localhost/applications/yourcompany/ instead of
> http://www.yourcompany.com/ Again, usually, but not always.
>
> Or, look at a different way to grab the results of the file you are calling.
> Can't you replicate its functionality in the current page so that an HTTP
> request is not required?
>
> A
>
>

Re: connecting to localhost by Christoph

Christoph
Sat Jul 09 02:34:05 CDT 2005

Ray,

Thanks for your reply. Unfortunately I won't be able to alter the hosts
file. Plus the problem is not that I can't access the local server via
localhost - it's more: where do I go from here, i.e. how do I then
access my virtual server. This is where the host header scenario comes in.

Thanks

Christoph

Ray Costanzo [MVP] wrote:
> If this server were sitting next to you, another option would be to put an
> entry in the HOSTS file (typically in %windir%\system32\drivers\etc) that
> resoluves to 127.0.0.1, but has a name other than localhost. Then you'd add
> that name as another host header for your site. Is this an option?
>
> Ray at work
>
> "Christoph Lutz" <CLutz@gmx.net> wrote in message
> news:42cea970$0$6291$ed2619ec@ptn-nntp-reader03.plus.net...
>
>>Ray,
>>
>>The server can't resolve DNS - even if it could, there would most likely
>>be firewall and NAT issues, so the only reliable way is to connect to
>>localhost and then send the appropriate headers. I am looking at opening
>>sockets and sending appropriate headers - or indeed any other way that
>>achieves the same by using localhost is what I need. Anyone?
>>
>>Christoph
>>
>>Ray Costanzo [MVP] wrote:
>>
>>>What do you mean, it can't see itself? Is this a DNS name resolution
>
> issue?
>
>>>That's my guess. Ask your host if the server is able to resolve dns
>
> names,
>
>>>and if not, if it's possible to make it so that it can. Since the
>
> server is
>
>>>using host headers, you will have to make the http request to your site
>
> by
>
>>>one of the recognized host header names. If the server doesn't have any
>
> DNS
>
>>>server setting, this won't be possible, afaIk.
>>>
>>>Ray at work
>>>
>>>"Christoph Lutz" <CLutz@gmx.net> wrote in message
>>>news:42ce8dd3$0$6282$ed2619ec@ptn-nntp-reader03.plus.net...
>>>
>>>
>>>>Hi,
>>>>
>>>>I have got a scenario where an asp script needs to request via xmlhttp a
>>>>file sitting on the same server. The code all works find on my local
>>>>machine. However, on the hosting server, it does not. The problem is
>>>>that I am on a shared server and the server can't "see itself", i.e.
>>>>it's probably blocked by the host to receive request from itself. The
>>>>problems comes in as the server will hold multiple sites and use host
>>>>headers to channel request. I thought of using "localhost" and some kind
>>>>of header sending scenario to get the server to go to the correct
>>>>subfolder/virtual host. However, googling has not brought up much. Has
>>>>anyone got ideas/similar scenarios and could point me in some helpful
>>>>directions?
>>>>
>>>>Thanks
>>>>
>>>>Christoph
>>>
>>>
>>>
>
>

Re: connecting to localhost by jeff

jeff
Sat Jul 09 11:35:30 CDT 2005

On Fri, 08 Jul 2005 15:29:39 +0100, Christoph Lutz <CLutz@gmx.net>
wrote:

>I have got a scenario where an asp script needs to request via xmlhttp a
>file sitting on the same server. The code all works find on my local
>machine. However, on the hosting server, it does not. The problem is
>that I am on a shared server and the server can't "see itself", i.e.
>it's probably blocked by the host to receive request from itself. The
>problems comes in as the server will hold multiple sites and use host
>headers to channel request. I thought of using "localhost" and some kind
>of header sending scenario to get the server to go to the correct
>subfolder/virtual host. However, googling has not brought up much. Has
>anyone got ideas/similar scenarios and could point me in some helpful
>directions?

"Localhost" won't do it unless there's a localhost header in the host
headers for a site. Use a different method to address the system,
such as the actual host name, FQDN, IP address or whatever.

Jeff