Is this possible in ASP?

Results 1 to 2 of 2

Thread: Is this possible in ASP?

  1. #1
    Duke Marley Guest

    Default Is this possible in ASP?

    I know the following isn&#039t valid .asp coding because you can&#039t have asp within an include..... but how would i create the equivalent of:<BR> <BR>&#060;!--#include file="&#060;%=Request.QueryString("prod")&#037;&#0 62;.inc"--><BR> <BR>I&#039d like to include a text file who&#039s name is brought in from the Query String...... is there any way to do this? I guess .asp processes the includes before any .asp coding...... which leaves me unsure of how to accomplish this task. Do i even have to use the #include syntax? Is there a way to insert a text file (or .inc... etc. ) into a page within .asp....... Say for instance i got a name from the query string and assigned a variable to it:<BR> <BR>&#060;%<BR>dim strTest <BR>strTest= Request.QueryString("prod")<BR>&#037;&#062;<BR> <BR>Now i need a way have a text file named whose name is extracted from strTest inserted into the page.<BR> <BR>Any suggestions?? Am i trying something impossible?

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Is this possible in ASP?

    If you will only have a small set of include files, you can hard code them in:<BR><BR>&#060;%<BR>Dim strFileName<BR>strFileName = Request.QueryString("filename")<BR><BR>Select Case strFileName<BR>Case "blah.txt" &#037;&#062;<BR>&#060;!--#include file="blah.txt"--><BR>&#060;% Case "somethingelse.txt" &#037;&#062;<BR>&#060;!--#include file="somethingelse.txt"--><BR>&#060;% End Select &#037;&#062;<BR><BR>That&#039s one way. You can implement the "opening a text file" approach you mentioned as long as the text file doesn&#039t contain ASP code. Well, the file can contain ASP code, but it won&#039t get parsed by the server. So, if your file only is HTML, then, yes, the opening the text file is the way to go. Hope this makes sense! :)

Posting Permissions

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