I am a beginner and trying to work out how to cache a .txt file with a list of words so that the file can be searched and displayed, i understand that its better from a performance point of view and data handling to pre-cache this, but is it better to do this on a certain page load if there are multiple pages or at the start of the application. also I'm having trouble working out the proper way to cache a .txt file so that the list of words from the .txt can be search when needed. But with a .txt file the process has me stumped am i setting this up wrong or is my coding just poor here is the code i running for the .txt caching.

    var listOfWords = Request.Form["listOfWords"];
    var greeting = "Welcome";
    var weekDay = DateTime.Now.DayOfWeek;   
    var greetingMessage = greeting + " Here in Birmingham it's " + weekDay;    
    var listmessage = "";

    WordList words;
    if (WebCache.Get("words") == null)
        words = new WordList(Server.MapPath("wordlist.txt"));
        WebCache.Set("words", words);
        words = WebCache.Get("words");
    if (IsPost)
        var list = Request["text"];
        listmessage = "Results List";        
    if (IsPost)
        if (listOfWords.IsEmpty())
            ModelState.AddError("listOfWords", "Please enter a word");
    StreamReader file = new StreamReader(Server.MapPath("wordlist.txt"));

    var dataFile = Server.MapPath("Resources/wordlist.txt");
    Array ShowFile = File.ReadAllLines(dataFile);       

<!DOCTYPE html>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <meta/ charset="utf-8"><meta/>
    <p>@greetingMessage </p>   
        <form method="post">
                <legend>Enter a word to search the .txt file</legend>
                        <input type ="text" name ="listOfWords" value ="@listOfWords"/>
                <p><button type="submit">Search</button></p>
                <p>@listmessage <p>@listOfWords</p> 
        @foreach (string dataLine in ShowFile)
            foreach (string dataItem in dataLine.Split(','))
            <br />