473,466 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

writeline containing '<%'

7 New Member
Hi all

I am using a writeline method to create a new page containing all required code.

However, included within the page code are various asp calls.

The problem I have is that the asp page writing the page will error every time it comes accross "<%" or "%>" within the writeline.

Do any of you have any ideas on how to get around this? Many thanks in advance...

eg. Anything under line84 is going to err...
Expand|Select|Wrap|Line Numbers
  1.  
  2. 80 writethis.WriteLine("<!--#include virtual=""/alt/alt.asp"" -->")
  3. 81 writethis.WriteLine("<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">")
  4. 82 writethis.WriteLine("<link rel=""stylesheet"" href=""/ccss/ccl.css"" type=""text/css"">")
  5. 83 writethis.WriteLine("<script language=""javascript"">")
  6. 84 writethis.WriteLine("window.myMen = ""<%=session(""myMen"")%>"";")
  7. 85 writethis.WriteLine("window.mySub = ""<%=session(""mySub"")%>"";")
  8. 86 writethis.WriteLine("</script>")
  9.  
Jun 17 '08 #1
6 1917
DrBunchman
979 Recognized Expert Contributor
Hi Linto81,

Have you tried using the following replacements:

< can be replaced with &lt;
> can be replaced with &gt;

See if those work for you.

Dr B
Jun 17 '08 #2
Linto81
7 New Member
Hi and thanks...

It does stop the error, but then when the page displays, any asp code is actually written to the page as HTML rather than as working code.

so within your page, you will see items such as <% whatever code here %> instead of it just working!

Thanks, but not quite there unfort...
Jun 17 '08 #3
DrBunchman
979 Recognized Expert Contributor
What about separating the ASP brackets like this:
Expand|Select|Wrap|Line Numbers
  1.  
  2. 84 writethis.WriteLine("window.myMen = ""<" + "%=session(""myMen"")%" + ">"";")
  3.  
Any good?

Dr B
Jun 17 '08 #4
jeffstl
432 Recognized Expert Contributor
I can't help but also wonder the order of processing here.

Since a .asp page is compiled and executed on the server when it is requested, I am confused as to how you are using this method.

So a .js program generates the page when a user requests it? That would generate a .asp page but in order for it to work it has to be requested in a similiar fashion from the web server.

In other words the bottom line is that whatever .asp page your code is generating ......has to at some point be requested from the browser...... But how do you generate the page and execute the page with a single user request ?

I am mostly asking out of curiousity.
Jun 17 '08 #5
Linto81
7 New Member
Dr B... please accept a virtual pint of your favourite ale! Thanks...

It is always the simplest thing that eludes you isn't it?! ALl I did was replace the + for a & as I am doing this is ASp not JS. Which might asnwer your question Jeff...

It is oart of a content management system. When you add an item to the menu, you can request it to create a page at the same time. It does this by using the asp writeline method having written the file to a folder.

But, obviously, the site pages have various asp calls and includes in them so you have to be careful how you write the page or else it will fail on display.

I hope that answers your question. (I know I can easily just call a page and then the content into the same page using an id number, but the site it drives is much more slick and requires no calls for id numbers - it does that using session variables (even telling a collapsing menu what to open on the next page).. its v complicated... hence the reason I didn't think about the simple stuff!!

Thanks guys...
Jun 17 '08 #6
DrBunchman
979 Recognized Expert Contributor
Dr B... please accept a virtual pint of your favourite ale! Thanks...
Gratefully drunk!

Glad that you got it sorted.

Dr B
Jun 17 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Giganews | last post by:
I'm facing a crazy problem: <% spc = "<abcd" response.write spc %> will not work, spc is empty. When I replace <abcd with ab<cd, then spc contains only ab.
2
by: nautonnier | last post by:
Hello, I have a C# app that spawns several processes each containing a console app written by another developer in C++. The console app was written first to be just like a console app: it...
1
by: sklett | last post by:
I just noticed the other day that I had almost 100k *.log files in the root of my system drive. They all had a guid for a filename and were all 0 bytes in size. I narrowed the problem down to one...
4
by: john | last post by:
Hi to All, I am new to html authoring, so sorry if my terminology is not correct or exact. I would like to position a footer div to the bottom of the browser window. As I research in the web...
3
by: ptek | last post by:
Hi, For example, if I do : using System.IO; using (StreamWriter sw = new StreamWriter("text.txt")) { sw.WriteLine("coupé");
8
by: vunet.us | last post by:
I create an ASP file using fso.createtextfile. But how do I avoid double quotes and <% %signs when writing to file? FileAsp.WriteLine("<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252">")...
2
by: dan.goyette | last post by:
Hello. I'm new to C#. I've searched this group, and tried other google searches, and have not found an answer to this question already. The question is pretty simple. I like the Console.WriteLine...
5
by: Hels Bells | last post by:
Hi, I'm looking to do some manipulation on a string containing html code in asp which will involve me either using some regular expressions or just plain old simple replace functionality. The...
3
by: Author | last post by:
I have always been wondering if there is any significant different between doing System.Console.WriteLine("Employee Name = " + employee.FirstName + " " + employee.LastName); and ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.