Create ASP Dynamically

Results 1 to 10 of 10

Thread: Create ASP Dynamically

  1. #1
    Sting Guest

    Default Create ASP Dynamically

    Hi all,<BR><BR>I am wondering whether you could create ASP dynamically.<BR><BR>For example, say I have a string of ASP scripts, can I convert this string into actual ASP code?<BR><BR>strASP = "Response.Write(" & Chr(34) & "Something" & Chr(34) & ")"<BR><BR>Is it possible to run this string w/ ASP code in the ASP page?<BR><BR>I know that I could use #include to insert ASP file into an ASP page. However, SSI is not dynamic; it wont allow me to pick which file to include because it is processed before the ASP script.<BR><BR>Althought, I have read that IIS 5 and ASP include a new function for the Server Object, Server.Execute. It allows you to execute any ASP or HTML page.<BR><BR>Has anyone use this new method already? Can I use this method w/ IIS 4.0? If yes, how can I get this newer version of ASP.<BR><BR>Any help will be greatly appreciated.<BR><BR>Sting <BR><BR>

  2. #2
    Nathan Pond Guest

    Default RE: Create ASP Dynamically

    Not sure if it will work in your case, but read up on the Eval() function. As far as I know it is only used for mathematical operations. But by nesting eval() functions you could be able to execute statements stored in a variable. Just a thought, not sure if it will work.<BR><BR>Nathan

  3. #3
    Sting Guest

    Default RE: Create ASP Dynamically

    Hi Nathan,<BR><BR>Thank you for your reply. The Eval() function is not quite work. For example, if I have:<BR>&#060;%<BR>Dim variable <BR>Dim strVar<BR><BR>variable = 1<BR><BR>strVar = "If (variable = 1) Then Reponse.Write(" _<BR> & Chr(34) & "Hello, you have variable 1" _<BR> & Chr(34) & ")" _<BR> & "End If"<BR>Eval(strVar)<BR>%&#062;<BR><BR>The Eval() function will not able to convert this string into ASP script. Although, if I have:<BR>strVar = "Response.Write(" & chr(34) & "hello world" _<BR> & chr(34) & ")"<BR>Eval(strVar)<BR><BR>The Eval() function will work in executing this ASP script.<BR><BR>Sting

  4. #4
    Nathan Pond Guest

    Default RE: Create ASP Dynamically

    Try nesting evals:<BR><BR>&#060;%<BR>Dim variable <BR>Dim strVar<BR><BR>variable = 1<BR><BR>strVar = "If (variable = 1) Then Reponse.Write(" _<BR>& Chr(34) & "Hello, you have variable 1" _<BR>& Chr(34) & ")" _<BR>& "End If"<BR>Eval(Eval(strVar))<BR>%&#062;<BR><BR>Agai n, I haven&#039t tested this or anything, just a thought. Let me know how it turns out.<BR><BR>Nathan Pond<BR><BR><BR>


  5. #5
    Sting Guest

    Default RE: Create ASP Dynamically

    Hi Nathan,<BR><BR>Thanks for another reply. It is still working w/ another Eval(). It gives me this error:<BR><BR>Microsoft VBScript compilation error &#039 800a03ea&#039 <BR><BR>Syntax error <BR><BR>Regards,<BR><BR>Sting <BR>

  6. #6
    Join Date
    Dec 1969
    Posts
    760

    Default RE: Create ASP Dynamically

    VB uses a cr/lf to indicate the end of an instruction.<BR>You need to add a vbCrLf after each "line"<BR><BR><BR>!Eval Rules,Beware eval-ing arbitrary code!

  7. #7
    Sting Guest

    Default RE: Create ASP Dynamically

    Hi Andrew, <BR><BR>Thank your for the reply. I have added vbCrLf after each line of code. However, it still doesn&#039t work.<BR><BR>Regards,<BR>Sting

  8. #8
    Mark Guest

    Default RE: Create ASP Dynamically

    Haven&#039t tried - but been very close to needing to - why not have you current ASP write an entire new ASP page, and then redirect to the new one?

  9. #9
    marlin Guest

    Default RE: Create ASP Dynamically

    I&#039ve read the discussion - am i missing something - what about subs and calls mixed with the ever popular select case based on user input to checkboxes or radio (if that what you mean by dynamic) the use could decide if the page is going to access a dbase or draw a table or show gif or what ever - or have i miss the whole point

  10. #10
    Join Date
    Dec 1969
    Posts
    699

    Default RE: Create ASP Dynamically

    Sting,<BR><BR>I have created ASP scripts dynamically...<BR><BR>User requests URL/asp page<BR>ASP page runs all DLL<BR>DLL generates an ASP page<BR>DLL redirects to newly generated ASP page.<BR>ASP page dynamically creates HTML<BR>User sees end result<BR><BR>It was a HUGE project that took over 6 months with a team of 5.<BR>I doubt there are too many people out there doing stuff like this. There just really isnt that much of a need for it.<BR><BR>The project actually was much more complex than this - not only did we create asp pages on the fly, but we also created server objects (DLL&#039s) and client side ActiveX controls (ocx&#039s) on the fly. It was a great system to be able to create an ocx on the fly, license it, cab it, and send it to the client browser :)<BR><BR>If you want more info on this, give me an email:<BR>a-peteda@micrsoft.com<BR><BR>Windows 2000 contains IIS5. There is a beta out, and RC2 is going to be released soon. RC1 is kinda shadey, I would wait for RC2.<BR><BR>Good luck!<BR>Peter<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •