Skip to content

Connecting to a server to read a log file.

Shawn

Asked Aug 9, 2007, 2:43 AM EDT3 answers
Share
LinkedInX

Hi,
I am new to programming and very new to C#. I appreciate all the help that I could get. Thanks much,


Console Application--
--1) I have a UserName and Password and IP Address of a Server which is on the same network as mine.
--2) I want to access that Server.
--3) I want to open and search a log file located in C:\Develop\ (on that Server) for lines which contain "Copy not sent" and if this string is found, I want to copy the whole line. The log files are created every day as mmddyy.txt. I want to check for the latest file.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    This is what have in VB so far:

    dim fPath as string = "\\server\folder\mmddyy.txt"
    Dim fStream As FileStream = New FileStream(fPath, FileMode.Open, FileAccess.Read, FileShare.Read)
    dim fr as new streamReader(fStream)

    while not fr.EndOfStream
    dim lineText as string = fr.Read
    if instr(lineText,"Copy not sent") <> 0 Then
    'do something with it
    end if
    end while

    But I don't know how to do it in C#. I do not know how to search for the latest mmddyy.txt in the folder. and the biggest do not know is how to access the server where the files reside. the server is on the same network and it has a username and password to connect to

    thank you much
    0
  • 0

    Oh, no help in this forum...why is it so?

    0