By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

Question: Write file to "Secured" dir in website

P: n/a
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!
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Secured\MyFile.txt" doenst look like valid path to me

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

or

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

would work

Mike
"VB Programmer" <gr*********@go-intech.com> wrote in message news:<uU**************@TK2MSFTNGP10.phx.gbl>...
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!

Nov 17 '05 #2

P: n/a
"Secured\MyFile.txt" doenst look like valid path to me

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

or

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

would work

Mike
"VB Programmer" <gr*********@go-intech.com> wrote in message news:<uU**************@TK2MSFTNGP10.phx.gbl>...
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!

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.