Is there a way to keep the StreamWriter open?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Here is my current code:

Imports System.IO

Partial Class _Default

Inherits System.Web.UI.Page



Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim FILENAME As String = "C:\inetpub\wwwroot\zzJunkWriteTextFile\Log\output.csv"

Dim objStreamWriter As StreamWriter

objStreamWriter = File.AppendText(FILENAME)

objStreamWriter.WriteLine(Request.RawUrl & "," & DateTime.Now.ToString())

objStreamWriter.Close()

End Sub

End Class





Every time some hits this page it writes a line to a text file. I wanted to find out if I can keep the StreamWriter open to speed up the process?

.



Relevant Pages

  • Re: Is there a way to keep the StreamWriter open?
    ... Partial Class _Default ... Protected Sub Page_Load(ByVal sender As Object, ... Dim FILENAME As String = ... Dim objStreamWriter As StreamWriter ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Is there a way to keep the StreamWriter open?
    ... The reason I want to write to a text file is because the database isn't able to keep up with the heavy traffic. ... Protected Sub Page_Load(ByVal sender As Object, ... Dim FILENAME As String = ... Dim objStreamWriter As StreamWriter ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Is there a way to keep the StreamWriter open?
    ... Your server-side code is run on the server (as the ... Protected Sub Page_Load(ByVal sender As Object, ... Dim FILENAME As String = ... Dim objStreamWriter As StreamWriter ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Decode QueryString and redirect to new form
    ... Partial Class EmpList ... Public instance As Page ... Public mySession As HttpSessionState ... Protected Sub Button1_Click(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Decode QueryString and redirect to new form
    ... Partial Class EmpList ... Public instance As Page ... Public mySession As HttpSessionState ... Protected Sub Button1_Click(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.aspnet)