VistaDB 6
In This Topic
    How To Test Medium Trust ASP.NET applications
    In This Topic

    Shared Hosting

    VistaDB works great in a shared hosting environment. The only requirements are that the shared host support Dot Net 2, and provide you with a read / write directory for your database. There are no ODBC connections required, and you can run in a Medium Trust environment. This is a problem with many other database engines since they require the OLEDBPermission set, which is more than Medium Trust allows.

    In order to run in a medium trust environment all third party components must run under Medium Trust also. This means that all components must be marked with the AllowPartiallyTrustedCallers attribute. VistaDB fully supports this configuration and may be used within tools that require this level of trust.

    Forcing Medium Trust locally for testing

    If you want to force your local machine to run under Medium Trust also for testing your application prior to deployment there are a few simple changes required to your web.config file.

    You must mark the trust level in the web.config like this:

    Force Medium Trust in Web.Config
    Copy Code
    <system.web>
       <trust level="Medium"/>
    </system.web>
    

    You can place that line in the <system.web> </system.web> block of the web.config. This will force the local website to run as a medium trusted assembly, just like on a shared host. This is great for testing your asp.net application prior to FTP'ing it to the host.

    Remember that you still must have read/write access to the database directory if you want to update the database. If you do not have read / write permissions you should open the database in readonly mode for reading only.

    ASP.net Connection String shortcut

    For ASP.net 2 or higher applications the |DataDirectory| is a macro to the App_Data directory under your website. Use this in your connection string like this:

    connectionString="Data Source=|DataDirectory|\database.vdb6;Open Mode = NonexclusiveReadWrite;" 
    

    The |DataDirectory| will automatically map the base path of your application and append the App_Data to the end. This is a great alternative to using the Server.MapPath() function call (usually blocked on shared hosts with Medium Trust enabled).