Find all Files in .aspx files that match a string

I have an application that the files are stored in a directory.  I would like to create a C# page were a user can enter in specific text and the application would read the entire directory and return the file names and line numbers where the text occurs.  This is to help users find the information for.  So an example out put, possibly in a list view or grid view would be like this:

X files found

Name      Location
a.aspx     25
b.aspx     25
c.aspx      30

Any ideas of where I might find a starter sample? Here is one that is in VBScript that works, but i need to convert the code to C#.  Didn't want to reinvent the wheel here.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

To list all of the files in a directory, you can use System.IO.Directory.GetFiles() which will return an array. See for examples.

You could then loop through that array and read individual files using System.IO.StreamReader, looping through the return of StreamReader line by line. See for an example.

From there, you could search the string of each line.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
atljarmanAuthor Commented:
Thank you.  I looked at the code you suggested and modified what I had.  For others visiting to the site, may need to look up how to loop through the GetFiles functionality.  I ended up with a different solution based on your suggestion that allows me to get multiple file extensions.  Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.