By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,864 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,864 IT Pros & Developers. It's quick & easy.

writeline containing '<%'

P: 7
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
Share this Question
Share on Google+
6 Replies


DrBunchman
Expert 100+
P: 979
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

P: 7
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
Expert 100+
P: 979
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
Expert 100+
P: 432
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

P: 7
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
Expert 100+
P: 979
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

Post your reply

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