473,625 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Remove "http://localhost" from my URLs

I am testing a web app that links to user defined URLs. I want the link
to be the exact text the user provided but I can't seem to get rid of
the "http://localhost" prefix in the link. Note that I am user defined
email addresses for "mailto:" links and the same problem occurs.

Is this something that will be removed when the site is published?

All help is appreciated,
Lee

Feb 7 '06 #1
3 5077
Does this prefix appear in the generated HTML code of the web page? Or is it
the browser who is too smart?

"Lee Roth" <le******@gmail .com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I am testing a web app that links to user defined URLs. I want the link
to be the exact text the user provided but I can't seem to get rid of
the "http://localhost" prefix in the link. Note that I am user defined
email addresses for "mailto:" links and the same problem occurs.

Is this something that will be removed when the site is published?

All help is appreciated,
Lee

Feb 8 '06 #2
It's the browser. The HTML in the code is basic. For example:

string userURL = userURLTextBox. Text; // say the user inputs
"www.google.com "
string htmlCode = "<a href = " + userURL + "> User Link </a>";

But instead of just google the link becomes
"http://localhost/www.google.com" which is a page it obviously can't
find.

So how do I use the code to make sure this doesn't happen to the end
users?

Thanks,
Lee

Feb 8 '06 #3
Hey Lee,

You can automatically prefix any user input with http:// if the input does
not start with any protocol specification (bear in mind that these are not
only http:// or https://, can also be ftp:// or even telnet://)

"Lee Roth" <le******@gmail .com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com...
It's the browser. The HTML in the code is basic. For example:

string userURL = userURLTextBox. Text; // say the user inputs
"www.google.com "
string htmlCode = "<a href = " + userURL + "> User Link </a>";

But instead of just google the link becomes
"http://localhost/www.google.com" which is a page it obviously can't
find.

So how do I use the code to make sure this doesn't happen to the end
users?

Thanks,
Lee

Feb 9 '06 #4

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

Similar topics

6
73754
by: aa | last post by:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini in php.ini I have: SMTP = localhost SMTP_PORT = 25 SENDMAIL_FROM = NULL SENDMAIL_PATH = "H:\WINNT\system32\" (this is where sendmail.dll is sitting. H is the drive with w2k)
24
4476
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html with a link to http://www.domain2.com/page2.html you can abbreviate the second link as //www.domain2.com/page2.html
3
1595
by: Robin Tucker | last post by:
Should I consider this to work in other locales? If theServer.Name <> "(local)" and theServer.Name <> "(localhost)" Then ' Can only use local machine in this version..... End If
31
4841
by: Yeah | last post by:
Is it absolutely necessary to include "http://" in an A HREF hyperlink? Would it be wise to remove this from one's Links page, just to save code?
5
2117
by: KenLee | last post by:
help: how can I change from "//localhost:numbers/" to just "//localhost/"? I can see the web pages using "//localhost:numbers/" instead of ""//localhost/". I use asp.net 2.o. and windows 2000. how can i set up from "//localhost:numbers/" to just "//localhost/" so that other people could see the page not the error message. .....
3
2120
by: John Nagle | last post by:
I'm getting a wierd error from urllib2 when opening certain URLs. The code works for most sites, but not all of them. Here's the traceback: InfoSitePage EXCEPTION while processing page "http://www.fourmilab.ch": Problem with page "http://www.fourmilab.ch": HTTP error -1 - .. Traceback (most recent call last): File "D:\projects\sitetruth\InfoSitePage.py", line 318, in httpfetch fd = url_opener.open(self.requestedurl) #...
0
1248
by: almurph | last post by:
Folks, Hope that you can help me here. Just a quick question. I as using IIS 5.1 and can download a web service from SourceSafe onto my developers box. Let call the project "WebServiceA" However my system will not all to create the default website: http://localhost/WebServiceA but rather creates as default:
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8694
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...
1
8356
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,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5570
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
4089
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...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
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
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.