cpradio, thank you for your thoughtful response. I want to do more than just caching. I want to use REGEX to modify the content of the page, as demonstrated in my code below.
Because I want to modify the HTML with REGEX, enabling Page Caching will not do the trick. A stringbuilder approach might be ugly but it is what I need.
This would be very easy to do with PHP:
$outputData = ob_get_contents();
Is there any way at all to do this with ASP.NET / VB?
Thanks for the help.
Code:
<%@ Page Language="VB" AutoEventWireup="false" %>
<%
Response.BufferOutput = true
%>
Hello
<%
Response.write("Earth")
Dim outputData as String
outputData = buffer.ToString() ' THIS LINE DOES NOT WORK! IT IS THE LINE THAT NEEDS FIXING!!!!!!!!!!!
outputData = System.Text.RegularExpressions.Regex.Replace(outputData.Trim(), "(?=\s\s)\s*?(\n)\s*|(\s)\s+", "$1$2")
Response.Clear()
Response.write(outputData)
IO.File.WriteAllText(Server.MapPath("output.txt"), outputData)
%>
Bookmarks