Is it possible to open a file in .NET with non-exclusive write access? If so, how? I hope that two or more processes will be written to the same file at the same time.
Edit: Here is the context of this question: I am writing a simple HTTPModule protocol for IIS. Since applications running in different application pools run as separate processes, I need a way to share the log file between processes. I could write a complicated file locking procedure or a lazy writer, but this is a project with a throwaway, so its not important.
This is the test code I used to determine the process.
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Threading; namespace FileOpenTest { class Program { private static bool keepGoing = true; static void Main(string[] args) { Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress); Console.Write("Enter name: "); string name = Console.ReadLine();
Ryan michela
source share