DeploymentVirtualDirectory
' needs to be set as an empty string at development time. But the correct virtual directory name will needed at the deployment time. The application will use the configuration information through one of the model classes 'ApplicationSettings
' implemented in the 'ApplicationSettings.cs' file in the 'Models' folder.public
properties of this class. static
utility class 'ApplicationUtility
' is implemented in the 'ApplicationUtility.cs' file in the 'Utilities' folder. public
methods to format the URLs. Two of them are used to create the link to the CSS file and the link to the jQuery script library. To format the URLs, the correct virtual directory name needs to be configured in the 'Web.config' file in the root directory. At development time, this value need to be an empty string. ExistingFilesModel
' implemented in the 'ExistingFiles.cs' file in the 'Models' folder represents the MVC application's model. DataTable
'. It also exposes public
methods to add a file, delete a file, and retrieve the list of the files. An instance of this class will be saved in the application's web session. FileUploadExampleController
' class in the 'FileUploadExampleController.cs' file in the 'Controllers' folder.DataTable
' in the web session, so Visual Studio is the only thing needed to develop and debug the application. In any practical web applications, persistent data storage is needed to save the files.ApplicationUtility
' to address the 'relative path problem' related to the ASP.NET MVC applications. The 'FormatURL
' method is to use the 'DeploymentVirtualDirectory
' information configured in the 'Web.config' file to make sure the correct URLs are generated regardless of where the application is deployed. When debug run the application, the 'DeploymentVirtualDirectory
' needs to be an empty string. At deployment time, the correct virtual directory name needs to be written into the 'Web.config' file.