VistaDB 6
VistaDB / Developer's Guide / How To Perform Common Tasks / Use VistaDB Providers for ASP.NET Websites / Forcing app database connections closed
In This Topic
    Forcing app database connections closed
    In This Topic

    Web Applications Often Keep Database Open

    Your website has the database locked and kept open all the time if it is active, so how would you upload a new database? Let's say you have a website and you want to force all the database connections closed so you can update the database from a local copy. How would you do that without having access to the server?

    Microsoft provided a way to do this through taking the website offline.

    Taking your website offline

    Create a file named App_Offline.htm and upload it to the root of the website. Hit the homepage and it should show the offline page. Then all database connections are closed, and you can safely upload a new database.

    Website Database Maintenance

    This is also a good idea for when your website needs to do maintenance on the database (packing the database is required periodically). You could setup a script on the server that puts the App_Offline.htm file on the site, make a backup of the database, pack the database, then delete the file to put the site back online.

    ScottGu has a blog post about this technique.

    See Also