Server Error in '/' Application.

The process cannot access the file 'E:\NetDocs\karenvis\WriteReadData\Hitcounter.txt' because it is being used by another process.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'E:\NetDocs\karenvis\WriteReadData\Hitcounter.txt' because it is being used by another process.

Source Error:


Line 92:         {
Line 93: 
Line 94:             TextWriter TxtWtr = new StreamWriter(Server.MapPath("~/WriteReadData/Hitcounter.txt"));
Line 95: 
Line 96:             TxtWtr.WriteLine(Convert.ToString("1"));

Source File: e:\netdocs\karenvis\Global.asax    Line: 94

Stack Trace:


[IOException: The process cannot access the file 'E:\NetDocs\karenvis\WriteReadData\Hitcounter.txt' because it is being used by another process.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10576183
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +2580
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +138
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) +98
   System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) +139
   System.IO.StreamWriter..ctor(String path) +42
   ASP.global_asax.gethitcounts() in e:\netdocs\karenvis\Global.asax:94
   ASP.global_asax.Session_Start(Object sender, EventArgs e) in e:\netdocs\karenvis\Global.asax:30
   System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +11290012
   System.Web.SessionState.SessionStateModule.CompleteAcquireState() +366
   System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1281
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +85
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263


Version Information: Microsoft .NET Framework Version:2.0.50727.8813; ASP.NET Version:2.0.50727.8762