How to Open a Remote Text File using Server.MapPath in ASP.Net?

Posted by NJTechGuy on Stack Overflow See other posts from Stack Overflow or by NJTechGuy
Published on 2010-03-21T13:57:23Z Indexed on 2010/03/21 14:01 UTC
Read the original article Hit count: 427

This is what I have right now for a file residing on the same server and it works.

Dim FILENAME as String = Server.MapPath("Output.txt")

Dim objStreamWriter as StreamWriter
objStreamWriter = File.CreateText(FILENAME)

dr = myCommand.ExecuteReader()
While dr.Read()

objStreamWriter.WriteLine("{0}|{1}|{2:yyyy-MM-dd}|{3:yyyy-MM-dd}", dr(0),  dr(1), dr(2), dr(3))

End While
objStreamWriter.Close()

I was planning on FTPing the file to another server once done but is there a way to do it on a remote server? i.e create a text file on a remote server and write to it? Did not find any instances of that usage. How to use ServerXMLHTTP to replace Server.MapPath in this instance?

Thank you so much for your time.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about remote-file-inclusion