How to access the relative directory of a ASP.NET website?
- by Michael Schilling
I need to access a folder that will contain various text files for my web site. I'm using Visual Web Developer 2010 Express. I made a web site using visual basic. Here is the failing code:
Dim fileName As String
fileName = CurDir.ToString + fileName.Text + ".txt"
FileOpen(1, fileName, OpenMode.Output)
FileClose(1)
CurDir.ToString is giving me strange directory path that isn't anywhere near where my website files are located. I need to be able to access the files in a folder inside of the WebSite1 folder without using C:\Users\..., but I'm at a loss on how to do that. Can anyone help me out?