473,698 Members | 2,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connecting to localhost

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
Jul 22 '05 #1
7 1868
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" <CL***@gmx.ne t> wrote in message
news:42******** **************@ ptn-nntp-reader03.plus.n et...
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

Jul 22 '05 #2
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" <CL***@gmx.ne t> wrote in message
news:42******** **************@ ptn-nntp-reader03.plus.n et...
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


Jul 22 '05 #3
> 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
Jul 22 '05 #4
If this server were sitting next to you, another option would be to put an
entry in the HOSTS file (typically in %windir%\system 32\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" <CL***@gmx.ne t> wrote in message
news:42******** **************@ ptn-nntp-reader03.plus.n et...
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" <CL***@gmx.ne t> wrote in message
news:42******** **************@ ptn-nntp-reader03.plus.n et...
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


Jul 22 '05 #5
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

Jul 22 '05 #6
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%\system 32\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" <CL***@gmx.ne t> wrote in message
news:42******** **************@ ptn-nntp-reader03.plus.n et...
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" <CL***@gmx.ne t> wrote in message
news:42***** *************** **@ptn-nntp-reader03.plus.n et...
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
direction s?

Thanks

Christoph


Jul 22 '05 #7
On Fri, 08 Jul 2005 15:29:39 +0100, Christoph Lutz <CL***@gmx.ne t>
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
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2057
by: maddunr | last post by:
Hi, I just installed PHP 4.3.9, MySQL 4.0.2 and PHPMyAdmin 2.6.0-pl3 on our intranet server (Win2k3 running IIS). I also have a similar setup on my local machine (http://localhost/phpmyadmin). Everything seems normal when I work on the server machine (also known as web-nt with IP xxx.xxx.xx.xx), but when I try connecting to the MySQL database on the server from my local machine (http://web-nt/phpmyadmin), two things happen:
5
4593
by: Maurice LING | last post by:
Hi, I've been using FB1.5 and access the database using Kinterbasdb + Python. My connection is established using kinterbasdb.connect() method and the parameters host, dns, database, user, password are all defaulted to 'None'. On my own machine running Mac OSX 10.3, I can connect using the following: host = 'localhost' database = '<my path to FB database>'
6
1802
by: MBS | last post by:
Yeah, read the previous posts...I did that. None answer my question. I just installed PHP 5.0.4, Apache 2.0.54, and MySQL 4.1.13 a few days ago on WinXP SP2. My goal is to learn to use these programs. I cannot, absolutely cannot connect to MySQL using PHP. I've tried everything possible including the mysqli functions. I have no idea what is wrong. I don't get any error messages at all. It's almost as if PHP stops processing the...
4
1798
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using System.Data.SqlClient; using System.Threading; namespace TestSQL { class Class1
14
1854
by: John Spiegel | last post by:
Hi all, I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. I've installed the SQL Server developer edition locally and do have a pubs database. The connection I'm attempting is the following: SqlConnection objConnection =
1
1524
by: scottrm | last post by:
We have multiple developers all using a shared development server. Recently we have migrated to a new server. I copied all the project folders across and created virtual directories mapped to and with the same name as the project folder (same as the old server) but when I create a new solution and try to add the existing projects from the new development server I get the following message. "Unable to open Web project 'qssweb/CTSubs'. ...
7
4049
by: Frances | last post by:
this seems pretty straight-forward.. got this code $link = mysql_connect('localhost:3306', '<uid>', '<pswd>'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); from here..
9
4300
by: darthghandi | last post by:
I am trying to create a server application using asynchronous sockets. I run into a problem when I try to connect to my server using a non-.net program. I can establish the connection, and send some packets in response to the programs first message, but when I receive a response back, it's the last packet I sent. After that packet, I receive the packet I really wanted. This only happens when I connect with local host. I tried...
0
2412
by: brum2008 | last post by:
Hello! Below is the Netbeans Mobility source code for my application (The application offers SPP service, and then just hangs waiting for a client to connect (using acceptAndOpen()). The other device (A7 Engineering's eb506 Bluetooth serial adapter connected to a microcontroller) connects to the phone, but is not linked to my application). If I make the connection directly from the phone (Nokia 6085) to the eb506, there is no problem...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.