Question: Write file to "Secured" dir in website

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!
 
M

Michael Evanchik

"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
 
M

Michael Evanchik

"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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top