Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Plain text
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Plain text

 Post Reply Post Reply
Author
Mc Brain View Drop Down
Senior Member
Senior Member


Joined: 11 June 2002
Location: Argentina
Status: Offline
Points: 223
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mc Brain Quote  Post ReplyReply Direct Link To This Post Topic: Plain text
    Posted: 17 June 2003 at 7:36pm

How do you get to show a plain text in an ASP? I want to show some html code (in the page), so that the user can copy and paste it (in their pages). But I want the "<" to be pasted as "<" and not like "&lt;"... and all that stuff.

How can I do this?

Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2003 at 12:54am

If you mean show ASP code on a page, then the quickest way is to use the <xmp> tag, however im unsure of its compatability, other than that using &lt; and &gt; for the < and > at the start and end of code is fine.

www.w3schools.com has a list of these types of shortcuts

Back to Top
Bullschmidt View Drop Down
Groupie
Groupie


Joined: 31 May 2003
Location: United States
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bullschmidt Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2003 at 2:41am

Or you might try something using Server.HTMLEncode such as this:

<%
varFld = "Hi <b>there</b>"
varFld = Server.HTMLEncode(varFld)
Response.Write varFld
%>

And the above would show all the code in the initial varFld = line and the word "there" would NOT be bold but instead the user would see the bold tags around it.

J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
Back to Top
Mc Brain View Drop Down
Senior Member
Senior Member


Joined: 11 June 2002
Location: Argentina
Status: Offline
Points: 223
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mc Brain Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2003 at 4:00am

I cannot understand, Bullschmidt why when I tried in a single ASP with nothing but the lines you wrote it worked.... and when I tried to implemented within the ASP I had, it doesn't:

Function Encode(sCode)

   Encode = Server.HTMLEncode(sCode)

End Function

<% Response.Write Encode("<!-- " & StartCaption & "-->") %>

I get the "&lt;" pasted instead of the "<". What's going wrong here?

 

Back to Top
Bullschmidt View Drop Down
Groupie
Groupie


Joined: 31 May 2003
Location: United States
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bullschmidt Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2003 at 6:45am
Yes it does seem like it would do the "&lt;" thing but at least it's down automatically even though the user originally pasted in a < .  I just thought it was another approch worth considering.
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.