storing asp code in the database

Discussion in 'C#' started by red_fiesta, Nov 15, 2006.

  1. #1
    i need to save some asp code into the database so that i can use it in one page

    the code i want to convert is


    Code:

    <%
    url= Request.ServerVariables("URL")
    if request("file")="error" then
    response.Write("There has been an error and this file doesnt exist.<br />")
    end if%> 
    <form action="/cm/website/file/validate/DownloadManager.asp?file=2&url=<%=url%>" method="post">
    
    <input type="submit" value="Download File" />
    
    </form>
    Code (markup):


    I tried to do this but get an error when i try and close the %>

    this is the code i have that has an error...



    Code:
    
    <%
    text = "<%url= Request.ServerVariables(""URL"") " & vbCrlf 
    text = text & "if request(""file"")=""error"" then" & vbCrlf 
    text = text & "response.Write(""There has been an error and this file doesnt exist.<br />"")" & vbCrlf 
    text = text & "end if"& vbCrlf 
    text = text & "%>"& vbCrlf 
    text = text & "<form action=""DownloadManager.asp?file=2&url=<%=url%>"" method=""post"">" & vbCrlf 
    text = text & "<input type=""submit"" value=""Download File"" />" & vbCrlf 
    text = text & "</form>" 
    %>
    <%=text%>
    
    Code (markup):


    any ideas?


    error is

    Microsoft VBScript compilation error '800a0409'

    Unterminated string constant
     
    red_fiesta, Nov 15, 2006 IP
  2. DatR

    DatR Peon

    Messages:
    210
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try adding

    text = text & "%\>"

    at the end

    i believe when you put %> in a "" for a string you need to escape that > with the \
     
    DatR, Nov 16, 2006 IP