B
bj daniels
I have a text file at a particular URL (physical path is not part of the
website). Though I could link to the file and it would open - what I really
need to do is to be able to get the text in that file into a variable.
since the file is not part of the website I am working on (it is part of a
different virtual server), the mappath doesn't seem to be working. Here is
what I am trying (captionfile parameter is the full path (by url - but could
be by UNC or drive letter) to the .txt file):
thanks
bj daniels
----------------------
Public Function GetCaption(ByVal CaptionFile As String) As String
Dim result As String
Dim fs As New FileStream(Server.MapPath(CaptionFile), FileMode.Open,
FileAccess.Read)
'Dim fs As New FileStream(CaptionFile, FileMode.Open,
FileAccess.Read)
Dim objReader As New StreamReader(fs)
'result = "<pre>"
While objReader.Peek > -1
result += Server.HtmlEncode(objReader.ReadLine) & "<br>"
End While
'result += "</pre>"
objReader.Close()
fs.Close()
Return result
End Function
website). Though I could link to the file and it would open - what I really
need to do is to be able to get the text in that file into a variable.
since the file is not part of the website I am working on (it is part of a
different virtual server), the mappath doesn't seem to be working. Here is
what I am trying (captionfile parameter is the full path (by url - but could
be by UNC or drive letter) to the .txt file):
thanks
bj daniels
----------------------
Public Function GetCaption(ByVal CaptionFile As String) As String
Dim result As String
Dim fs As New FileStream(Server.MapPath(CaptionFile), FileMode.Open,
FileAccess.Read)
'Dim fs As New FileStream(CaptionFile, FileMode.Open,
FileAccess.Read)
Dim objReader As New StreamReader(fs)
'result = "<pre>"
While objReader.Peek > -1
result += Server.HtmlEncode(objReader.ReadLine) & "<br>"
End While
'result += "</pre>"
objReader.Close()
fs.Close()
Return result
End Function