i'm quite new to asp.net using vb.
at the moment i've got created a sub to write some actions to a xml log file.
everything works fine, the only thing is that i need the source code on multiple pages, is there a way to include this code from a sepperate file, so when i've got some changes to make to the sub i only have to change it once?
Private sub WriteXML(ByVal XMLAction As String, ByVal XMLType As String)
Dim f As File
Dim FileName As String = Server.MapPath("log\log.xml")
Dim lines As List(Of String) = New List(Of String)(File.ReadAllLines(FileName))
'Remove Last Line
lines.RemoveAt(lines.Count - 1)
Dim fstream As FileStream
If f.Exists(FileName) Then
fstream = New FileStream(FileName, FileMode.Append, FileAccess.Write)
fstream = New FileStream(FileName, FileMode.Create, FileAccess.ReadWrite)
Dim sWriter As New StreamWriter(fstream)
'Write Lines To XML File
sWriter.Write("<Type>" + XMLType + "</Type>" + Environment.NewLine)
View Complete Post