Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Increasing the Maximum Upload Size

The 4MB default is set in machine.config, but you can override it in your web.config. For instance, to expand the upload limit to 20MB, you'd do this:

<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>

Since the maximum request size limit is there to protect your site, it's best to expand the file-size limit for specific directories rather than your entire application. That's possible since the web.config allows for cascading overrides. You can add a web.config file to your folder which just contains the above, or you can use the <location> tag in your main web.config to achieve the same effect. 

This will override the upload size limit for files within the N2 administration area only:

<location path="N2">
    <system.web>
        <httpRuntime executionTimeout="110" maxRequestLength="20000" />
    </system.web>
</location>

Error When Creating Directories

If your N2 root is not ~/, you may receive an error such as this when creating directories: 

Code Block
[NullReferenceException: Object reference not set to an instance of an object.]
   N2.Edit.FileSystem.Directory1.Reload() in c:\Projekt\OSS\github\n2cms\n2cms\src\Mvc\MvcTemplates\N2\Files\FileSystem\Directory.aspx.cs:44
   N2.Edit.FileSystem.Directory1.OnInit(EventArgs e) in c:\Projekt\OSS\github\n2cms\n2cms\src\Mvc\MvcTemplates\N2\Files\FileSystem\Directory.aspx.cs:35
   System.Web.UI.Control.InitRecursive(Control namingContainer) +140
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480

The workaround is to create an entry in your hosts file like

Code Block
127.0.0.1    n2site.enferno.local  n2site

Create the site in IIS manager, bind it to your name like n2site, and map the root to your project folder. Change project setting to Use Local IIS Server and set the project url to http://n2site 

Note

This workaround does not work on Windows Azure. When using N2 on Windows Azure you must use / as the root of your N2 site.

 

 

...