How do you set the string reader to readonly?
I have tried IO.File.OpenText and IO.File.OpenRead which the documentation sugests opens a file for read. I have also given the ASPNET account read and file scan permissions to that folder.
>>I am using the following procedure to attempt to read the most recent line in the www and ftp log files (\winnt\system32\Logfiles\W3SVC1\) but the catch statement reports the file is cannot be read because it is in use by another process. I assume this other process is IIS, but notepad and other file reading utilities can read these files fine. How can I accomplish the same in .NET?
>>
>>
>> private string LastFileLine (System.IO.FileInfo fi)
>> {
>> string LastLine = "";
>> try
>> {
>> System.IO.StreamReader sr = System.IO.File.OpenText(fi.FullName);
>> string line;
>> while ((line = sr.ReadLine()) != null)
>> {
>> LastLine = line;
>> }
>> sr.Close();
>> }
>> catch (Exception ex)
>> {
>> LastLine=ex.Message;
>> }
>> return LastLine;
>> }
>>
>>
>>Thanks in advance,
>>Troy
>I think you can just set the StringReader to ReadOnly Mode and you should be able to.
>
>Morgan