0

I am having trouble accessing information on the server my website it on. As the website was originally programmed with VB.Net, I cannot change the language without having to completely reboot the website. The way the website and server are configured, I can only use ASP.Net and VB.Net.

I am needing to add a section where they can create folders, edit folder names, and upload pictures and text documents on the server through the public website. I tried using parts of the FileIO, Server, and Http that should have worked, but none of them did. Most of my research is about local files and text documents.

I have not been able to find any information that works. Can someone help me? Thank you.

Tytus Strube
  • 27
  • 1
  • 7
  • I've added a quite generic answer. If you gave this a go, and let me know if this worked or not, I could update my answer accordingly with code samples. – Ignas Apr 11 '17 at 13:05

1 Answers1

0

Firstly, creating a virtual directory in ISS mapped to somewhere on your disk would be a good start. This way you have a separate folder for user data in a folder with write access (make sure IIS has write access to the folder!), and the folder is not affected by website deployments.

Secondly, you might need to resolve absolute path for most of the System.IO.File calls. See How to convert a relative path to an absolute path in a Windows application?, just you will need to convert this code to VB.

Community
  • 1
  • 1
Ignas
  • 4,092
  • 17
  • 28
  • I did try to get the absolute and relative path. Each one returned "D:\hosting.xxxxxxxx.........." as if it was a physical drive and not a URL. When I tried to use it in the code that followed, it tried to access the local D:\. The method I used for this was Server.MapPath(). – Tytus Strube Apr 11 '17 at 17:23
  • So what error did you get? Or what went wrong from what you expected to happen? File system and code will operate using absolute file system path, however your web application should use following URL pattern: http://example.com/virtual_directory/your_actual_folder/file.html – Ignas Apr 11 '17 at 19:45