急,读取文件问题。在线等
Dim path As String = " " " " & FileUpload1.PostedFile.FileName & " " " "
Dim sr As StreamReader = File.OpenText(path)----------报错
Do While sr.Peek() > = 0
Response.Write(sr.ReadLine())
Loop
sr.Close()
==============
报错
==============
System.ArgumentException: 路径中具有非法字符。
[解决办法]
path不对啊 你传入了什么?
[解决办法]
字符串作为参数传递的时候两边就不用再加上引号了。
[解决办法]
断点调试下,输出Path的值到底是什么,或者直接用路径替代Path调试看看
[解决办法]
Dim path As String = FileUpload1.PostedFile.FileName
Dim sr As StreamReader = File.OpenText(path)
Do While sr.Peek() > = 0
Response.Write(sr.ReadLine())
Loop
sr.Close()