Using FileUltimate in an ASP.NET WebForms project

To use FileUltimate in an ASP.NET WebForms Project, do the following in Visual Studio:

  1. Make sure you have added references to FileUltimate assemblies as described here.

  2. Optionally set FileUltimate's global configuration (if overriding a default value is required). For example, you may want to set the license key.

    You can specify the configuration in <appSettings> tag of your Web.config.

    XML
    <appSettings> <!-- Set this property only if you have a valid license key, otherwise do not set it so FileUltimate runs in trial mode. --> <add key="FileUltimate:LicenseKey" value="QQJDJLJP34..." /> </appSettings>

    As you would notice, FileUltimate: prefix maps to FileUltimateConfiguration.Current and FileUltimateWeb: prefix maps to FileUltimateWebConfiguration.Current.

    Alternatively you can specify the configuration in code, in Application_Start method of your Global.asax.cs:

    C#
    protected void Application_Start(object sender, EventArgs e) { //Set this property only if you have a valid license key, otherwise do not //set it so FileUltimate runs in trial mode. FileUltimateConfiguration.Current.LicenseKey = "QQJDJLJP34..."; }
  3. Create a new page (eg. Default.aspx) and insert these lines (after Page directive at the top):

    ASPX
    <%@ Register TagPrefix="GleamTech" Namespace="GleamTech.FileUltimate.AspNet.UI" Assembly="GleamTech.FileUltimate" %> <%@ Register TagPrefix="GleamTech" Namespace="GleamTech.FileUltimate.AspNet.WebForms" Assembly="GleamTech.FileUltimate" %> <!DOCTYPE html> <html> <head runat="server"> <title>File Manager</title> </head> <body> <GleamTech:FileManagerControl ID="fileManager" runat="server" Width="800" Height="600" Resizable="True"> <GleamTech:FileManagerRootFolder Name="A Root Folder" Location="~/App_Data/RootFolder1" > <GleamTech:FileManagerAccessControl Path="\" AllowedPermissions="Full"/> </GleamTech:FileManagerRootFolder> </GleamTech:FileManagerControl> </body> </html>

    This will render a file manager control in the page which displays one root folder named "A Root Folder" which points to "~/App_Data/RootFolder1" with Full permissions.

      Tip

    Alternatively you can add the namespaces globally in Web.config under <system.web>/<pages>/<controls> tag to avoid adding namespaces in your pages every time:

    XML
    <system.web> <pages> <controls> <add tagPrefix="GleamTech" namespace="GleamTech.FileUltimate.AspNet.UI" assembly="GleamTech.FileUltimate" /> <add tagPrefix="GleamTech" namespace="GleamTech.FileUltimate.AspNet.WebForms" assembly="GleamTech.FileUltimate" /> </controls> </pages> </system.web>

    If you need a standalone file uploader control, insert these lines instead:

    ASPX
    <%@ Register TagPrefix="GleamTech" Namespace="GleamTech.FileUltimate.AspNet.UI" Assembly="GleamTech.FileUltimate" %> <%@ Register TagPrefix="GleamTech" Namespace="GleamTech.FileUltimate.AspNet.WebForms" Assembly="GleamTech.FileUltimate" %> <!DOCTYPE html> <html> <head runat="server"> <title>File Uploader</title> </head> <body> <GleamTech:FileUploaderControl ID="fileUploader" runat="server" Width="600" Height="300" Resizable="True" UploadLocation = "~/App_Data/Uploads" /> </body> </html>