示例#1
0
        public string Read(string filePath)
        {
            // Check correct path
            if (File.Exists(filePath) && (filePath.EndsWith(".txt")))
            {
                // Check if the user can read txt files
                if (_roleProvider.CanReadTextFile(filePath))
                {
                    using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                    {
                        using (StreamReader streanReader = new StreamReader(fileStream))
                        {
                            return(streanReader.ReadToEnd());
                        }
                    }
                }
            }

            return(string.Empty);
        }