Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3443464
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:47:40+00:00 2026-05-18T08:47:40+00:00

A customer asked for quick and dirty log viewer for an ASP.NET app, for

  • 0

A customer asked for quick and dirty log viewer for an ASP.NET app, for which I’m using log4net, and I thought somehow we could simply add a controller to read the tail of the active file and spit it back.

If I use the standard .NET API (File.OpenText, etc.) I get access violation (file open by another process), which is what I expect, but I know it is possible to read the file because Ultraedit opens it for viewing read-only. Can I do the same from the .NET API?

using(StreamReader infile =
         System.IO.File.OpenText(Request.PhysicalApplicationPath + @"\log\my.log"))
{
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:47:41+00:00Added an answer on May 18, 2026 at 8:47 am

    Specify That you allow read/write sharing on the file, and put a StreamReader on your stream to get the same behaviour as File.OpenText.

    using( Stream stream = File.Open(@"x:\path\file.log", 
            FileMode.Open, FileAccess.Read, FileShare.ReadWrite) )
    {
        using(StreamReader sr = new StreamReader(stream))
        {
            //read content
        }
    }
    

    And since you can open the file with UltraEdit, I assume log4net is not putting an exclusive lock on the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A customer asked me a simple app that retrieves the telephone number given the
Our customer would like to know who is online and currently using the custom
Problem: Customer X has requested that pages using XML DataBinding and Databound tables in
The customer wants us to log the actions that a user performs on our
Background: Customer X has a CCK-based Content Type (vendorxxentry) and is using Views2 to
I'm developing a magento theme; but my customer asked me a particular modification: he
I know, we are in 2011 and not in 1998. But a customer asked
the other day i got an order from a customer and he asked me
I have a website which stores customer details, name, address, contact etc. A customer
I have been recently (and repeatedly) asked by customers about MIPS needed to run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.