Recently I started working with ASP.NET. So, I have an MVC site (a little different from the original template). I want to see the text from the file when I open the Home / About page ... Well, then you probably understand: I naively began to use StreamReader. As a result, our “favorite” FileNotFoundException . I have already tried different options: insert the code in cshtml using Razor, put the code in HomeController.cs . In general, please explain why the StreamReader does not work, why it does not find the file and how to fix it ... Oh yes! I do not know the full path)
string text; StreamReader sr = new StreamReader("TextFile1.txt") text = sr.ReadLine(); ViewBag.Message = text; PS File placed in the folder with the code and in the folder of the project
binfolder, and you will most likely be happy, but it is more logical inbin\add_data- teran