Hi All,
In my program I am loading the content of a text file (main.txt) into a
string called 'message'.
What I need is to convert all urls and emails in this string into html.
This is what I did to convert hard returns to <br>'s and it works fine:
Dim sws As New IO.StreamWriter (pathtosave)
sws.WriteLine(m essage.Replace( Chr(13), "<br>"))
So hard returns were easy, but how to do it in case of urls and emails?
So, that in case of url it should change "www.test.c om" to "<a
href="http://www.test.com">w ww.test.com</a>" and in case of email it
should change something like "te**@test. com" to "<a
href="mailto:te **@test.com">te **@test.com</a>"
Can someone help me out?
Martin 12 1685
Martin,
It is the urlencode.
By example this in the to
sTo = UrlEncode (sTo) http://msdn.microsoft.com/library/de...ncodetopic.asp
I hope this helps,
Cor
"MARTIN LANNY" <ma**********@g mail.com> schreef in bericht
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . Hi All,
In my program I am loading the content of a text file (main.txt) into a string called 'message'.
What I need is to convert all urls and emails in this string into html.
This is what I did to convert hard returns to <br>'s and it works fine:
Dim sws As New IO.StreamWriter (pathtosave) sws.WriteLine(m essage.Replace( Chr(13), "<br>"))
So hard returns were easy, but how to do it in case of urls and emails?
So, that in case of url it should change "www.test.c om" to "<a href="http://www.test.com">w ww.test.com</a>" and in case of email it should change something like "te**@test. com" to "<a href="mailto:te **@test.com">te **@test.com</a>"
Can someone help me out?
Martin
"MARTIN LANNY" <ma**********@g mail.com> schrieb: What I need is to convert all urls and emails in this string into html.
This is what I did to convert hard returns to <br>'s and it works fine:
Dim sws As New IO.StreamWriter (pathtosave) sws.WriteLine(m essage.Replace( Chr(13), "<br>"))
So hard returns were easy, but how to do it in case of urls and emails?
So, that in case of url it should change "www.test.c om" to "<a href="http://www.test.com">w ww.test.com</a>" and in case of email it should change something like "te**@test. com" to "<a href="mailto:te **@test.com">te **@test.com</a>"
I think that you'll have to implement the code to convert the URLs and
addresses to hyperlinks yourself. If you are dealing heavily with HTML, I
suggest to take a look at the 'HttpUtility' class which provides methods for
encoding URLs and text.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Hi, it won't let me use it.
I added:
Imports System.Web
....
..
Dim finalbody As String
finalbody = System.Web.Http Utility.htmlenc ode(message)
but "System.Web.htm lencode" is underlined saying that htmlencode is not
a member of system.web.
I also tried: finalbody = HttpUtility.htm lencode(message ), but that is
the same.
Why can't I use it?
ok, I figured how to make it work... let me test it now...
"MARTIN LANNY" <ma**********@g mail.com> schrieb: Hi, it won't let me use it.
I added:
Imports System.Web
Make sure your project contains a reference to "System.Web.dll ".
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Yeah thanks...I just realized...
It doesn't work:
dim message as string = "jo*@gnut.c om wrote in message"
Dim finalbody As String
finalbody = System.Web.Http Utility.HtmlEnc ode(message)
return finalbody
This is what it returns:
"<jo*@gnut.c om> wrote in message"
It should return this:
"<a href="mailto:jo *@gnut.com">jo* @gnut.com</a> wrote in message"
Any other ideas?
"MARTIN LANNY" <ma**********@g mail.com> schrieb: dim message as string = "jo*@gnut.c om wrote in message" Dim finalbody As String finalbody = System.Web.Http Utility.HtmlEnc ode(message) return finalbody
This is what it returns: "<jo*@gnut.c om> wrote in message"
It should return this: "<a href="mailto:jo *@gnut.com">jo* @gnut.com</a> wrote in message"
As I already said, you'll have to build the HTML code yourself.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
And I guess, that is what I needed a help with initialy.
I don't know how to convert text links to html coded links.
Maybe I wasn't very clear., but this System.Web.Http Utility.HtmlEnc ode
didn't do any of what I asked for. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dan glenn |
last post by:
I'm creating HTML emails from a PHP site and sending them out to an email
list (just about 40 people so far are on this list). I've tested and
confirmed that these emails work in yahoo.com's webmail. And I know they
work on *my* Outlook Express. But I have one person (I know of) who gets the
emails as plain text, so she sees the HTML code for the email instead of its
proper representation. She has, like myself, OE6, and other html emails...
|
by: Ambuj |
last post by:
Can anyone please let me know that how can I handle very long URLs in a text email? I'm writting a bulk email program in VB.Net which sends text emails. The problem is when I've a very long URL it is wrapped by my email client and the result is an unusable link
Is there anyway in which I can make sure that the whole URL is treated as a link even if it is wrapped to more than one lines
TIA
|
by: David Shorthouse |
last post by:
Hey folks,
Is anyone aware of any sort of asp coding to deal with long URLs? I have a
few asp that pull URLs from fields within a MS db, which then display on a
width-limited table. Is there any way to wrap these long URLs such that my
table doesn't get widened? e.g. wrapping at "/" or something similar?
Thanks for any advice,
Dave
|
by: Nicole |
last post by:
Hello,
Can anyone tell me or give me an online tool which can help me to
convert php dynamic urls to html urls to make a google friendly
site.I dont have apache server on my computer and I dont want to use
it.Wihtout apache server is it possible? And I amusing windows server
and not Linux.
Thanks
Sunita Bihani
|
by: maya |
last post by:
hi,
I'm designing an HTML email for a client.. I know general guidelines
(no CSS, no JavaScript... although I do use limited CSS, inside tags (as
in <span style=".."we do this at work and it works fine, so I figured
it's ok..)
but I have a few more questions, for example, is it ok to do client-side
image-maps? is there a web page somewhere with general guidelines for
HTML e-mails? (and what is best way to test HTML e-mails? (I...
| |
by: sck10 |
last post by:
Hello,
I am working on a new project where I need to:
1. open an email and then create an xml file from the email
2. open the xml file and parse the information.
I would like to be able to do the second step using a web page and then
duplicate it with a Windows Service. Does anybody know of some good links
on how to get started on something like this. I haven't created a Windows
Service before, so this will be new to me.
|
by: Jai |
last post by:
Hi,
I am in a problem of sending mass emails(newsletter) to my website
members.
Actually my problem is this:
I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.
|
by: Vlad |
last post by:
Hi!
My task: Take HTML -convert into plain text.
Sub-task:
1. Find all urls within HTML (<a href="http://www.abc.com">More
about baby bears</a>).
2. And convert them into plain text: More about baby brears (http://
www.abc.com)
|
by: davjoh |
last post by:
The following describes the problem I am having. Can anyone help?
$send_to = "davjoh123@yahoo.com";
$send_to = "production@advisiongraphics.com";
$send_to = "advision_galiano@mac.com";
|
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,...
|
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...
| |
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...
|
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,...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |