Skip to content
blackcity edited this page Jul 2, 2013 · 3 revisions

###Configuration basics: Using the web.config Backload. has a very rich set of configuration options. It can be entirely configured within the web.config file or alternatively a config file linked to the web.config. But, you do not have to set any option if you are happy with the defaults In this example we show you how to prepare the web.config file, so Backload. can be configured. In this example we want to change the root upload files path to "~/Uploads". Take a look how we utilize Visual Studio Intelligence and schema validation. ####Prepare the web.config in two simple steps:

  1. Declare a new section group with a config section
  2. Add the section group and a config section to the configuration element
<configuration>
  <configSections>
    ...
    <!-- Declare a new section group ("fileUploadGroup") with a config section ("fileUpload") within <configSections> -->
    <sectionGroup name="fileUploadGroup">
      <section name="fileUpload"
               type="Backload.Configuration.FileUploadSection, Backload, Version=1.7, Culture=neutral, PublicKeyToken=02eaf42ab375d363"
               requirePermission="false"
      </section">
    </sectionGroup>
  </configSections>
  <!-- Add the new declared section group ("fileUploadGroup") with the config section ("fileUpload") to the <configuration> element -->
  <!-- Note: The xmlns:* and xsi:* attributes enable schema validation and Visual Studio Intelligence in the config file -->
  <fileUploadGroup>
    <fileUpload storageContext="Filesystem" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xmlns:name="urn:fileupload-schema" 
                xsi:noNamespaceSchemaLocation="Web.FileUpload.xsd">
      <fileSystem filesRoot="~/Uploads" />
    </fileUpload>
  </fileUploadGroup>
  ...
</configuration>
    

####Conclusion This basic example shows how to prepare the web.config file for the Backload component. In this sample we set the root upload folder to "/Uploads" (default: "/files") and use the file system as storage context (default). Note: Don't forget to include the schema file (Web.FileUpload.xsd) into your root folder, otherwise schema validation and Visual Studio Intelligence won't work. Make sure you have the appropriate write permissions. In the next example we show you how to use a separate config file in order to keep the web.config configuration clean.

Code

Code examples: Example02


License

Backload. (Standard version): Copyright 2013, Steffen Habermehl, License (Standard version): MIT license
Professional and Enterprise (source code) version are available under a commercial license.
Follow us on Twitter: @Backload_MVC

Clone this wiki locally