|
Author: Jenny Nguyen
|
|
If you need to do some manipulation to your text/xml file then you could read the text from the file into the StringBuilder object. You can use the StreamReader object to do this, and it is simple. Here's how: Imports System.Text Imports System.IO
Partial Class _Default Inherits System.Web.UI.Page
Public Sub New() 'Read text file or xml file into the string builder object
Dim filePath As String = Server.MapPath("~/") & "smithc.xml" Dim resultsBuilder As StringBuilder = New StringBuilder() 'Dim sbSmith As StringBuilder = New StringBuilder Dim sReader As StreamReader = New StreamReader(filePath) Dim line As String
Do line = sReader.ReadLine() resultsBuilder.Append(line) Loop Until line Is Nothing sReader.Close()
Response.ContentType = "text/xml" Response.Write(resultsBuilder.ToString()) End Sub End Class
Comments (3)
"
|