locked
Virtual Directory vs. File system RRS feed

  • Question

  • User104071772 posted

    Greetings Asp.net Geniuses


    Recently, I have been contemplating whether to save my images into a file system or create a virtual directory in IIS 7. Which option would be best?


    Thank you.



    Sunday, February 7, 2010 6:19 PM

Answers

  • User197322208 posted

    Usually, the problem is whether to save in Database or FileSystem(solved with FileStream from SqlServer 2008)

    If there are static images, and you envision reading from another site, the solution is with virtual directory(or site) in IIS7.

    Otherwise, filesystem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 7, 2010 6:55 PM

All replies

  • User197322208 posted

    Usually, the problem is whether to save in Database or FileSystem(solved with FileStream from SqlServer 2008)

    If there are static images, and you envision reading from another site, the solution is with virtual directory(or site) in IIS7.

    Otherwise, filesystem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 7, 2010 6:55 PM
  • User104071772 posted


    Below is what I will be implementing to save to the virtual directory.   As you can see I am trying to save as you would to a filesystem. Is this method the best. Or is there another way.

     

     


     'DETERMINE IF THE FILE DIRECTORY EXIST IF NOT CREATE AND ENTER IN NEW FILE.
                        '----------------------------------
                        If Directory.Exists("Http://Img.Mysite.com/member/" + CurrentMonth + "/" + CurrentDay + "/" + City + "/") Then
                            'File saved to the file directory on the server in the Users\Month folder.
                            Try
                                ImagetoUpload.Save("Http://Img.Mysite.com/member/" + CurrentMonth + "/" + CurrentDay + "/" + City + "/" + newfilename.ToString)

                            Catch ex As Exception

                            End Try

                        Else
                            Directory.CreateDirectory("Http://Img.Mysite.com/member/" + CurrentMonth + "/" + CurrentDay + "/" + City + "/")
                            'File saved to the file directory on the server in the Users\Month folder.

                            Try
                                ImagetoUpload.Save("Http://Img.Mysite.com/member/" + CurrentMonth + "/" + CurrentDay + "/" + City + "/" + newfilename.ToString)

                            Catch ex As Exception

                            End Try
                        End If

    Sunday, February 7, 2010 8:28 PM