does anyone know what the most efficient way to read in a file, search it
and then replace a key word with the contents of another file?  I want to
create a wrapper, read it in search it for ~~REPLACE THIS~~ when I find it
replace it with the contents from another file.  here is my code so far but
I am stuck and haven't found much on the web.

<%@ Import Namespace="System.IO" %>
<script language="vb" runat="server">
  sub Page_Load(sender as Object, e as EventArgs)

    Dim FILENAME as String = Server.MapPath("../template20020826.htm")
    Dim objStreamReader as StreamReader
    Dim contents as String
    Dim tester as boolean
    tester = true

        objStreamReader = File.OpenText(FILENAME)
        Do While tester = true
     contents= objStreamReader.ReadLine()
     if(contents = "~~Replace This~~") Then
                                        
                Dim FILENAME2 as String = Server.MapPath("../travis.htm")
        Dim objStreamReader2 as StreamReader
    
                objStreamReader2 = File.OpenText(FILENAME2)

        Dim innerContents as String = objStreamReader2.ReadToEnd()
                contents = contents & innerContents
         end if
         if (contents = "") Then Exit Do
        Loop
        
        Output.Text = contents
    
    objStreamReader.Close()

  end sub
</script>
<asp:label runat="server" id="Output" />


This communication, including attachments, is for the exclusive use of 
addressee and may contain proprietary, confidential or privileged 
information. If you are not the intended recipient, any use, copying, 
disclosure, dissemination or distribution is strictly prohibited. If 
you are not the intended recipient, please notify the sender 
immediately by return email and delete this communication and destroy all copies.


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to