469,313 Members | 2,206 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,313 developers. It's quick & easy.

writeline containing '<%'

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 1749
DrBunchman
979 Expert 512MB
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
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 Expert 512MB
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 Expert 256MB
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
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 Expert 512MB
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.

Similar topics

2 posts views Thread by dan.goyette | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.