Creating a "translate" function in ASP.NET, streaming in HTML from the web?

Discussion in 'ASP .Net' started by kennethfine, Jul 23, 2003.

  1. kennethfine

    kennethfine Guest

    I'm transitioning from ASP development, please excuse
    these basic questions. One thing I did often in ASP was
    create a "translate" function to render one string to
    another, strip out excess carriage returns, etc.

    I want to do the same thing in ASP.NET. I have a mail
    component that will accept HTML, but it requires all HTML
    to be listed on a single line. It takes the syntax:

    msgObj.BodyParts.Add(" <html markup here> "),
    BodyPartFormat.HTML)

    Can someone point me to how I might translate a string
    with carriage returns/newlines into a single unbroken
    line? How about if I wanted to translate one character to
    another?

    Best would be if ASP.NET would actually visit a live page
    on the web, strip out the HTML it needs, and embed it in
    the string above as a single line.

    Thanks in advance for any pointers or resources you might
    be able to provide.

    -KF
     
    kennethfine, Jul 23, 2003
    #1
    1. Advertisements

  2. I bet your mail component will accept a variable which contains carriage
    returns.

    But you should look at the methods of the System.String class. In
    particular,

    Dim x as String = "something with CR and/or LF in it"
    Dim stripped as String = x.Replace(ControlChars.vbCr, "
    ").Replace(ControlChars.vbLf, " ")

    Note I'm replacing with a space, so that "A<CrLf>B" doesn't become "AB".

    --
    John Saunders
    Internet Engineer



    "kennethfine" <> wrote in message
    news:065901c35161$7c0ead00$...
    > I'm transitioning from ASP development, please excuse
    > these basic questions. One thing I did often in ASP was
    > create a "translate" function to render one string to
    > another, strip out excess carriage returns, etc.
    >
    > I want to do the same thing in ASP.NET. I have a mail
    > component that will accept HTML, but it requires all HTML
    > to be listed on a single line. It takes the syntax:
    >
    > msgObj.BodyParts.Add(" <html markup here> "),
    > BodyPartFormat.HTML)
    >
    > Can someone point me to how I might translate a string
    > with carriage returns/newlines into a single unbroken
    > line? How about if I wanted to translate one character to
    > another?
    >
    > Best would be if ASP.NET would actually visit a live page
    > on the web, strip out the HTML it needs, and embed it in
    > the string above as a single line.
    >
    > Thanks in advance for any pointers or resources you might
    > be able to provide.
    >
    > -KF
     
    John Saunders, Jul 23, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tian Min Huang
    Replies:
    0
    Views:
    442
    Tian Min Huang
    Jul 23, 2003
  2. Aaron Lewis
    Replies:
    0
    Views:
    718
    Aaron Lewis
    Jul 23, 2003
  3. Replies:
    0
    Views:
    377
  4. Replies:
    5
    Views:
    760
    Faizal Tan
    Jan 14, 2005
  5. Replies:
    1
    Views:
    605
Loading...

Share This Page