You can't do it in one function!
I can't help you in ASP.NET, but i can explain it in VB.NET ;)
To search MS Word's documents use build-in in MS Word application
Find.Execute[
^] method.
There are two methods to create MS Word application:
1) using Interop.Services
2) using OLE.
In the first case you need to add reference to Interop.Serices and write code like this:
Dim wrdApp = New Word.Application
The advantage is: client's computers does not need MS Word application.
In the second case you need to create MS Word application like this:
Dim wrdApp As Object = Nothing
wrdApp = CreateObject("Word.Application")
Now you have access to all methods and functions in MS Word ;)
The disadvantage of this approach is the requirement to install MS Word on the client's computers.
Read more about:
early/late bound[
^].