Configuring and Troubleshooting

Note

You can refer to the web-to-print solution based on AJAX Vector Objects, Customer's Canvas. You can consider it as a ready-to-use editor that you may want to embed into your website or as an example demonstrating how AJAX Vector Objects can be used for your needs.

This topic describes how to configure AJAX Vector Objects to store temporary files in a cache.

It also describes different approaches for determining issues, which may occur when your application works on both the server and client sides.

Working with Cache

When you launch an application using AJAX Vector Objects, it automatically creates a cache that preserves temporary files. By default, the cache is located in App_Data\FileCache of your web application. However, you can configure the cache, changing its path and the time the files are stored. If you need to specify cache settings, create a section inside the <configSections> tag of the web.config file and specify parameters as the following snippet shows:

ASP.NET
<configSections>
  <section name="Aurigma.GraphicsMill.AjaxControls.VectorObjects.FileCacheConfiguration" type="System.Configuration.NameValueSectionHandler, 
    System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<Aurigma.GraphicsMill.AjaxControls.VectorObjects.FileCacheConfiguration>
  <add key="RootPath" value="C:\AJAXVectorObjectSamples\App_Data\Cache"/>
  <add key="MaxFileLifeTimeSeconds" value="5000"/>
</Aurigma.GraphicsMill.AjaxControls.VectorObjects.FileCacheConfiguration>

You can see from the snippet that the RootPath key allows you to change the path of the cache. Note, that the value takes the absolute path as a parameter. The MaxFileLifeTimeSeconds value limits the time files are stored in the folder. Remember, that the cache is cleared only when the application addresses it. Thus, even if MaxFileLifeTimeSeconds = 1 second, files in the cache will not be deleted automatically a second later unless the application accesses the cache.

Troubleshooting

AJAX Vector Objects provides flexible ways for determining and solving problems occurring when your application works. If an error occurs, AJAX Vector Objects writes a message describing the error to the System.Diagnostics.Debug by default. This means that you can see all the errors in the Output window in Visual Studio. For example, if you specify an incorrect path to fonts, you will see the following warning:

Output Window States an Warning

If you do not want to use Debug for debugging errors in your application, you can create your own logger. AJAX Vector Objects allows you to redirect all error messages to your logger. All you need to do is set the Configuration.LoggerFactoryMethod property. The following snippets demonstrate how to work with LoggerFactoryMethod:

C#
Aurigma.GraphicsMill.AjaxControls.VectorObjects.Logger.ILogger logger =  
    Aurigma.GraphicsMill.AjaxControls.VectorObjects.Logger.DotNetDebugLogger.Instance;
Aurigma.GraphicsMill.AjaxControls.VectorObjects.Configuration.LoggerFactoryMethod = () =>logger;
Note

The logger you create needs to implement the ILogger interface and its Trace(String), Warning(String), and Error(String) methods.

Client Scripts Debugging

If you need to debug your application on the client side, you can use JavaScript console. After you open JavaScript console, you can find CanvasViewer by specifying the following command:

$find("<CanvasViewer_id>")

For instance, to get CanvasViewer created in the Your First Application with AJAX Vector Objects article, we need to specify this command, as the following image illustrates:

Using JavaScriptConsole

After getting CanvasViewer, you can perform the same commands in JavaScript console as on the client side. For example, the following command returns a current object on Canvas:

Using JavaScriptConsole: Getting Current Object

See Also

Reference

Manual

Other