我想读取file.txt的内容,但这些代码不起作用。以文本格式显示doc文件asp.net c#
string[] readText = File.ReadAllLines(path); this line is giving error.
protected void btnRead_Click(object sender, EventArgs e)
{
string path = fileupload1.PostedFile.FileName;
if (!string.IsNullOrEmpty(path))
{
string[] readText = File.ReadAllLines(path);
StringBuilder strbuild = new StringBuilder();
foreach (string s in readText)
{
strbuild.Append(s);
strbuild.AppendLine();
}
textBoxContents.Text = strbuild.ToString();
}
}
üR读取文件的类型(* .TXT?) – andy
你想读在上传时的文件吗? – Priya
我想阅读doc file.help me – Akshada