?
Solved

Putting ASP code as text on a page

Posted on 1998-09-15
10
Medium Priority
?
195 Views
Last Modified: 2013-12-25
I want to post ASP code on a page so that users who want it included on their page can "cut-n-paste". What should I do?
As soon as I type <% It reads it as a command...

I've tried <pre> witch I figured wouldn't work and didn't.

Is there any ASP command for saying "this is text"?
0
Comment
Question by:aspdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1855035
Replace "<%" with "<pre>" and "%>" with "</pre>"

There is also the "viewsource.asp" which you can find in your example-asp's
0
 

Author Comment

by:aspdev
ID: 1855036
Well, I needed to have the "<%" ... otherwise it wouldn't be pure cut-n-paste :)

But I figured it out. All I had to do was to exchange all the "<" with "&lt;" and now it's working fine so I don't really need any solution. But thanx for trying to answer anyway.

/Marten
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1855037
do it like this:

<OBJECT DATA="yourasp.txt"></OBJECT>

This will put it in a box for cut and paste.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:MasseyM
ID: 1855038
do it like this:

<OBJECT DATA="yourasp.txt"></OBJECT>

This will put it in a box for cut and paste.
0
 
LVL 1

Expert Comment

by:TAMC
ID: 1855039
Just don't save it as an .asp page save it as an .htm.
0
 
LVL 1

Expert Comment

by:TAMC
ID: 1855040
Just don't save it as an .asp page save it as an .htm.
0
 

Author Comment

by:aspdev
ID: 1855041
As I said guys, I've already solved it on my own.
Sybe:The <pre> tag wont help since I want the <% to be shown...
TAMC: I still wanted to be able to format some og the text. So you idea don't work either.
MasseyM: I don't want to have to use an external file and I wouldn't be able to format some of the text.

ALL: The solution (as posted several times already) is to excange the "<" with "&lt;" that way it won't be interpreted as code. And when I want to format the text I can use the "<" to enter code. No need for an external file to be used either. Everything neatly collected in a single document.
0
 

Author Comment

by:aspdev
ID: 1855042
Hmm.. I figured I'd give the points to someone... Who can tell me how to write the sign " to a file via ASP? If I typ WriteLine(""") I get an obvious error-message. I want the " to BE a " in the file I write to, not just some HTML or URL code for it... how is this done?

btw: If you want to write <% or %> to a file without the ASp thinking you are trying to start/end a comman, do this WriteLine("<"&"%").
0
 

Accepted Solution

by:
shez earned 150 total points
ID: 1855043
" = Chr(34):
Writeline "somestring" & Chr(34) & "somesring"  
0
 

Author Comment

by:aspdev
ID: 1855044
It worked fine. I guess I feel abit guilty giving you the point but on the otherhand... they didn't help me nor did they solve my problem nor did they answer this last thing in reasonable time. So here ya go!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question