New Line in a string

cmdev

Member
Joined
Oct 16, 2003
Messages
5
Hello,
I have a string defined in the web.config. Basically its a tokenized string that I readin and do a myString.Replace("||name||",name). The problem is that I have a \n to indicate a new line. When I read in the stirng and send the string in the body of an email it doesnt put the new line/return in the email. It just shows up as \n. I have tried Environment.NewLine, I have tired ascii codes with no luck. Does anyone know how to do this. Other wise i have to do it by brute force...urgh

Thanks for any help!!!!
 
Hi,
you are writing "...send the string in the body of an email..."

-> Ill think you are using html email. There you have to linebreak with <br>
While you can not put <> into a string in the web.config you can do

mystring[br]xxxxxxx[br]
and
string s = ConfigurationSettings.Appsetting["anything"].Replace("[br]", "<br>");

or in web.config
mystring &lt;br&gt; xxxxxxxx


Regards, Stefan
 
Thanks that will work
But I am designing a web portal and I cant assume that everyones email is set to recieve html as opposed to plain text. I actually had it that way but my email was in text. At any rate.....In case anyone wants to know I just read in the string from web.conf, input it an arrary and go through the arry looking for \n and adding a new lin "\n" to a newly formatted string.

Thanks for your help. This site is GREAT !

Code Maniacs
 
Back
Top