Re: Is there a way to keep the StreamWriter open?

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



Hi,

The web server is already able to log this information (see the IIS
logging). Else
http://james.newtonking.com/archive/2007/06/05/enterprise-library-logging-vs-log4net.aspx
could be usefull. AFAIK in most cases, output is buffered and flushed in a
single go instead of being written immediately...


--
Patrice



"Bishop" <nospam@xxxxxxxxxx> a écrit dans le message de groupe de discussion
: 1DC4274B-9BBD-44E6-90B1-004467F91476@xxxxxxxxxxxxxxxx
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

  • Is there a way to keep the StreamWriter open?
    ... Partial Class _Default ... Protected Sub Page_LoadHandles Me.Load ... 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)