Response.Write containing %>

Discussion in 'ASP General' started by Dom, Jun 21, 2006.

  1. Dom

    Dom Guest

    Hi,

    I writing code that will create asp pages using the file system object. I'm
    trying something like this without much luck

    <%
    ..
    ..
    'other code here

    Response.Write "<%sName=" & Var & "%>"

    %>

    How can I do this?

    Thanks, Dom
     
    Dom, Jun 21, 2006
    #1
    1. Advertising

  2. Dom

    James Jones Guest

    now do you want VAR written out? or is that an actual variable on your
    pages?



    <%
    Response.Write "<%sName=" & Var & "%>"
    %> ^^ is that a variable you
    are trying to write out? or do you want all that in quotes written out,
    start with the first < and ending with the last >









    "Dom" <nospam> wrote in message
    news:%23L$...
    > Hi,
    >
    > I writing code that will create asp pages using the file system object.
    > I'm trying something like this without much luck
    >
    > <%
    > .
    > .
    > 'other code here
    >
    > Response.Write "<%sName=" & Var & "%>"
    >
    > %>
    >
    > How can I do this?
    >
    > Thanks, Dom
    >
     
    James Jones, Jun 21, 2006
    #2
    1. Advertising

  3. Dom

    Dom Guest

    This is the code I'm actually using:

    <%
    Dim oFileSystemObject, oFile, sFile, sPageContent

    Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")

    sFile = Server.MapPath("/services/test_inc.asp")

    Set oFile = oFileSystemObject.OpenTextFile(sFile, 1, false, 0)

    sPageContent = "<%iProductID=" & iID & "%>"
    sPageContent = sPageContent & oFile.ReadAll

    Set oFile = oFileSystemObject.CreateTextFile("C:\Inetpub\wwwroo\test.asp",
    true)

    oFile.WriteLine(sPageContent)

    oFile.Close()
    Set oFile = Nothing
    Set oFileSystemObject = Nothing
    %>

    "Dom" <nospam> wrote in message
    news:%23L$...
    > Hi,
    >
    > I writing code that will create asp pages using the file system object.
    > I'm trying something like this without much luck
    >
    > <%
    > .
    > .
    > 'other code here
    >
    > Response.Write "<%sName=" & Var & "%>"
    >
    > %>
    >
    > How can I do this?
    >
    > Thanks, Dom
    >
     
    Dom, Jun 21, 2006
    #3
  4. "Dom" <nospam> wrote in message
    news:%23L$...
    > Hi,
    >
    > I writing code that will create asp pages using the file system object.

    I'm
    > trying something like this without much luck
    >
    > <%
    > .
    > .
    > 'other code here
    >
    > Response.Write "<%sName=" & Var & "%>"
    >
    > %>
    >
    > How can I do this?
    >
    > Thanks, Dom
    >
    >


    try this

    response.write "&lt;%sName=" & Var & "%&gt;"
     
    Michael Kujawa, Jun 21, 2006
    #4
  5. Dom

    Dom Guest

    > now do you want VAR written out? or is that an actual variable on your
    > pages?
    >
    >
    >
    > <%
    > Response.Write "<%sName=" & Var & "%>"
    > %> ^^ is that a variable you
    > are trying to write out? or do you want all that in quotes written out,
    > start with the first < and ending with the last >


    Var is a variable. I've posted the actual code.
     
    Dom, Jun 21, 2006
    #5
  6. Dom

    Dom Guest

    This is the code I'm actually using:

    <%
    Dim oFileSystemObject, oFile, sFile, sPageContent

    Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")

    sFile = Server.MapPath("/services/test_inc.asp")

    Set oFile = oFileSystemObject.OpenTextFile(sFile, 1, false, 0)

    sPageContent = "<%iProductID=" & iID & "%>"
    sPageContent = sPageContent & oFile.ReadAll

    Set oFile = oFileSystemObject.CreateTextFile("C:\Inetpub\wwwroo\test.asp",
    true)

    oFile.WriteLine(sPageContent)

    oFile.Close()
    Set oFile = Nothing
    Set oFileSystemObject = Nothing
    %>
     
    Dom, Jun 21, 2006
    #6
  7. Dom

    James Jones Guest

    <%
    var = "James Jones"
    Response.Write "<%" & "sName = " & Var & "%>"
    %>


    that will display

    <%sName=James Jones%>


    <%
    Response.Write "<%" & "sName = & Var & %>"
    %>

    that will display:

    <%sName = & Var & %>






    hope this was helpful






    "Dom" <nospam> wrote in message
    news:%...
    > This is the code I'm actually using:
    >
    > <%
    > Dim oFileSystemObject, oFile, sFile, sPageContent
    >
    > Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
    >
    > sFile = Server.MapPath("/services/test_inc.asp")
    >
    > Set oFile = oFileSystemObject.OpenTextFile(sFile, 1, false, 0)
    >
    > sPageContent = "<%iProductID=" & iID & "%>"
    > sPageContent = sPageContent & oFile.ReadAll
    >
    > Set oFile = oFileSystemObject.CreateTextFile("C:\Inetpub\wwwroo\test.asp",
    > true)
    >
    > oFile.WriteLine(sPageContent)
    >
    > oFile.Close()
    > Set oFile = Nothing
    > Set oFileSystemObject = Nothing
    > %>
    >
     
    James Jones, Jun 21, 2006
    #7
  8. Dom

    Dom Guest

    <%
    > var = "James Jones"
    > Response.Write "<%" & "sName = " & Var & "%>"
    > %>
    >
    >
    > that will display
    >
    > <%sName=James Jones%>
    >
    > <%
    > Response.Write "<%" & "sName = & Var & %>"
    > %>
    >
    > that will display:
    >
    > <%sName = & Var & %>
    >
    > hope this was helpful


    It displays it on the page, however, IIS isn't processing it a VB script,
    just outputting it as HTML.
     
    Dom, Jun 21, 2006
    #8
  9. Dom

    James Jones Guest

    what are you wanting it to display exactly?


    type in what you are wanting to show, if you could














    "Dom" <nospam> wrote in message
    news:...
    > <%
    >> var = "James Jones"
    >> Response.Write "<%" & "sName = " & Var & "%>"
    >> %>
    >>
    >>
    >> that will display
    >>
    >> <%sName=James Jones%>
    >>
    >> <%
    >> Response.Write "<%" & "sName = & Var & %>"
    >> %>
    >>
    >> that will display:
    >>
    >> <%sName = & Var & %>
    >>
    >> hope this was helpful

    >
    > It displays it on the page, however, IIS isn't processing it a VB script,
    > just outputting it as HTML.
    >
    >
     
    James Jones, Jun 21, 2006
    #9
  10. Dom

    Dom Guest

    "James Jones" <> wrote in message
    news:...
    > what are you wanting it to display exactly?
    >
    >
    > type in what you are wanting to show, if you could
    >

    I want the script to assign data to the variable correctly.

    I posted the actual code earlier if you look through previous posts. I'm
    trying to create an asp page using the file system object with embedded vb
    scripts. Driving me bonkers now!
     
    Dom, Jun 21, 2006
    #10
  11. Dom wrote:
    > "James Jones" <> wrote in message
    > news:...
    >> what are you wanting it to display exactly?
    >>
    >>
    >> type in what you are wanting to show, if you could
    >>

    > I want the script to assign data to the variable correctly.
    >
    > I posted the actual code earlier if you look through previous posts.
    > I'm trying to create an asp page using the file system object with
    > embedded vb scripts. Driving me bonkers now!


    Posting code is not the same as posting the results you wish to see from the
    code. Look at it this way: you say the code is not working correctly. So how
    are we supposed to tell by looking at your code what your desired result
    should be?

    You're starting to drive us bonkers now.

    Let me reword it. if the code was to work correctly, and you ran the page,
    and viewed source of the resulting page, what would you see as a result of
    the code?

    One little quirk you should be aware of:

    You need to separate the < from the % when response.writing those
    characters:

    Response.Write "<" & "%" ...

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Jun 21, 2006
    #11
  12. > sPageContent = "<%iProductID=" & iID & "%>"

    If you do not want the "value" of iID written to the asp file
    but indeed want the variable to be processed in the new
    asp page you are creating then do as below.

    response.write "<% ProductID = iID %>"

    this will generate
    <% ProductID = iID %>

    If you want productID to be pre-assigned in the new page
    then
    response.write "<% ProductID = " & """" & iID & """" & "%>"

    this will generate the following

    <% ProductID = "value of iID" %>




    "Dom" <nospam> wrote in message
    news:...
    > This is the code I'm actually using:
    >
    > <%
    > Dim oFileSystemObject, oFile, sFile, sPageContent
    >
    > Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
    >
    > sFile = Server.MapPath("/services/test_inc.asp")
    >
    > Set oFile = oFileSystemObject.OpenTextFile(sFile, 1, false, 0)
    >
    > sPageContent = "<%iProductID=" & iID & "%>"
    > sPageContent = sPageContent & oFile.ReadAll
    >
    > Set oFile = oFileSystemObject.CreateTextFile("C:\Inetpub\wwwroo\test.asp",
    > true)
    >
    > oFile.WriteLine(sPageContent)
    >
    > oFile.Close()
    > Set oFile = Nothing
    > Set oFileSystemObject = Nothing
    > %>
    >
    > "Dom" <nospam> wrote in message
    > news:%23L$...
    > > Hi,
    > >
    > > I writing code that will create asp pages using the file system object.
    > > I'm trying something like this without much luck
    > >
    > > <%
    > > .
    > > .
    > > 'other code here
    > >
    > > Response.Write "<%sName=" & Var & "%>"
    > >
    > > %>
    > >
    > > How can I do this?
    > >
    > > Thanks, Dom
    > >

    >
    >
     
    Michael Kujawa, Jun 21, 2006
    #12
  13. Dom

    Dom Guest

    > Posting code is not the same as posting the results you wish to see from
    > the code. Look at it this way: you say the code is not working correctly.
    > So how are we supposed to tell by looking at your code what your desired
    > result should be?


    The code in my first post said it all. It's not exactly a difficult problem,
    just a quirk as you pointed out, and as I orginally thought. Did you read
    the first post or just decide to chip in towards the end?

    > Let me reword it. if the code was to work correctly, and you ran the page,
    > and viewed source of the resulting page, what would you see as a result of
    > the code?


    Why complicate the problem - it's a *simple* question.

    >
    > One little quirk you should be aware of:
    >
    > You need to separate the < from the % when response.writing those
    > characters:
    >
    > Response.Write "<" & "%" ...
    >


    The answer! Didn't hurt, did it?
     
    Dom, Jun 21, 2006
    #13
  14. >> Response.Write "<" & "%" ...
    >>

    >
    > The answer! Didn't hurt, did it?


    Yes, it did, because we had to pull teeth asking multiple times what RESULT
    you wanted. Why is that part so hard?
     
    Aaron Bertrand [SQL Server MVP], Jun 21, 2006
    #14
  15. Dom

    Patrice Guest

    Response.Write just displays whatever you tell it to display (wether or not
    it looks like ASP code, it's just "data"). You could use Execute or Eval to
    actually run this generated code.

    You may want also to tell us what is the problem you are trying to solve.
    Creating a program that creates code that should then run is likely rarely
    needed and it could be perhaps possible to achieve what you are trying to do
    in a simpler way...

    --
    Patrice

    "Dom" <nospam> a écrit dans le message de news:
    ...
    > <%
    >> var = "James Jones"
    >> Response.Write "<%" & "sName = " & Var & "%>"
    >> %>
    >>
    >>
    >> that will display
    >>
    >> <%sName=James Jones%>
    >>
    >> <%
    >> Response.Write "<%" & "sName = & Var & %>"
    >> %>
    >>
    >> that will display:
    >>
    >> <%sName = & Var & %>
    >>
    >> hope this was helpful

    >
    > It displays it on the page, however, IIS isn't processing it a VB script,
    > just outputting it as HTML.
    >
    >
     
    Patrice, Jun 21, 2006
    #15
  16. Dom

    Mike Brind Guest

    Dom wrote:
    > > Posting code is not the same as posting the results you wish to see from
    > > the code. Look at it this way: you say the code is not working correctly.
    > > So how are we supposed to tell by looking at your code what your desired
    > > result should be?

    >
    > The code in my first post said it all. It's not exactly a difficult problem,
    > just a quirk as you pointed out, and as I orginally thought. Did you read
    > the first post or just decide to chip in towards the end?
    >


    I'll chip in towards the end...

    Next time you want some help from volunteers in news groups (no one
    here is obliged to provide you any assistance), I suggest you read this
    thoroughly before bashing out your ill-framed questions:

    http://www.catb.org/~esr/faqs/smart-questions.html#forum

    --
    Mike Brind
     
    Mike Brind, Jun 21, 2006
    #16
  17. Dom

    Mike Brind Guest

    Mike Brind wrote:
    > Dom wrote:
    > > > Posting code is not the same as posting the results you wish to see from
    > > > the code. Look at it this way: you say the code is not working correctly.
    > > > So how are we supposed to tell by looking at your code what your desired
    > > > result should be?

    > >
    > > The code in my first post said it all. It's not exactly a difficult problem,
    > > just a quirk as you pointed out, and as I orginally thought. Did you read
    > > the first post or just decide to chip in towards the end?
    > >

    >
    > I'll chip in towards the end...
    >
    > Next time you want some help from volunteers in news groups (no one
    > here is obliged to provide you any assistance), I suggest you read this
    > thoroughly before bashing out your ill-framed questions:
    >
    > http://www.catb.org/~esr/faqs/smart-questions.html#forum
    >


    Remove the anchor from that link:
    http://www.catb.org/~esr/faqs/smart-questions.html

    --
    Mike Brind
     
    Mike Brind, Jun 21, 2006
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    2
    Views:
    8,098
    Charles A. Lackman
    Jan 11, 2006
  2. Matthew Wieder

    Response.Write and Response.Redirect

    Matthew Wieder, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    757
    Kevin Spencer
    Jul 17, 2003
  3. Sehboo
    Replies:
    3
    Views:
    8,934
    Sehboo
    Dec 10, 2003
  4. Replies:
    1
    Views:
    863
  5. slawekg

    Response.Write and Response.Redirect

    slawekg, Jun 21, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    405
    Alexey Smirnov
    Jun 21, 2007
Loading...

Share This Page