472,358 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

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 4736
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.googlegr oups.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*********************@g14g2000cwa.googlegro ups.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
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...
24
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...
3
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
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
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....
3
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...
0
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" ...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.