Question: Write file to "Secured" dir in website

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

I want to write a file to the "secured" dir that is on my website. The full
path is: C:\inetpub\wwwroot\MyWebSite\Secured

I tried this, but it didn't work:
Dim strFileName As String = "Secured\MyFile.txt"
Dim sw As New StreamWriter(strFileName)
sw.WriteLine("Testing 1-2-3")
sw.Close()
Response.Redirect(strFileName)

It gives me a System.IO.DirectoryNotFoundException.

Any ideas how I can reference this correctly?

Thanks!
 
"Secured\MyFile.txt" doenst look like valid path to me

Dim strFileName As String = "C:\inetpub\wwwroot\MyWebSite\Secured\MyFile.txt"

or

Dim strFileName As String = Server.Mappath("") & "\Secured\MyFile.txt"

would work



Mike
 
"Secured\MyFile.txt" doenst look like valid path to me

Dim strFileName As String = "C:\inetpub\wwwroot\MyWebSite\Secured\MyFile.txt"

or

Dim strFileName As String = Server.Mappath("") & "\Secured\MyFile.txt"

would work



Mike
 
Back
Top