views:

1438

answers:

5

I'm making some changes to a legacy classic ASP application. I've made the changes locally, and now I want to copy the changed files to the server. At the same time, I need to download the Access database, add some fields to some tables, and upload it again. For this reason, I need to be able to stop visitors from modifying the database while this is happening.

My main question is, what is the best way to setup a quick "Down for Maintenance" page that will be shown immediately and no matter which page the visitor requests. The application is already established, so I'd rather an answer that didn't require me to rework the application's architecture.

My second question (maybe this should be a separate question): Is there a better way to add fields to a db table than to copy it down, modify, and stick it up again? Please forgive if that's a dumb question - I'm new to ASP - new to Windows too.

I only have FTP access to the remote server.

Thanks.

+1  A: 

If you have just FTP access to the server (and no control over the IIS) just insert a response.redirect to the "down for maintenace" page in top of all the asp pages, and remove it when the update is completed.

The changes to the databse cna be performed with the ALTER TABLE statement.

mapache
ALTER TABLE. SQL! Of course! :PDon't I feel stupid. The unfamiliar environment was clouding my brain.So the plan is, stick the alter table statements into an asp file, upload it, request the page in a browser, then send up the rest of the files.Thanks mapacheJoel.
Joel
A: 

With regards to the "Down Maintanance" page issue you can and taking mapache's idea a step further if there is an included file (for a header) in each of the pages you can put the Response.Redirect in that one file and upload that in place. This will avoid making changes to all pages.

Another option is to upload a temp html file which will be found first by IIS. In IIS you can set which page name.ext are looked for in a domain/folder. For example when you browse to www.example.com you don't specify the page you are looking for so it could load index.html or index.htm for example depending on setup. It will depend on your hosts configuration setup, but a bit of trial and error I'm sure you can find out which one they use. Common ones for IIS are default.htm, default.html, index.html and index.htm. You can then put it in each of the folders in the website (not ideal I know) and then carry out your maintenance.

When updating databases you can run a migration script, written in sql, to update the schema and data of the db. As you only have FTP access this will require some sort of page you can paste the sql into and run. This however opens security issues so downloading the db, making the changes and then uploading again is probably easier. In addition to doing it this way you can also save the file and you'll have a backup :-)

Hope this helps.

WestDiscGolf
+2  A: 

two ways:

1

if you do a server-side include in every asp page you can do a response.redirect in that include to /upgrading.html

2

in global.asa you can do a response.redirect in the session on start event. THis is probably the best way. Will only work for .asp pages, not if the client comes to a .html page.

Espen
+1  A: 

Do you have any control panel access to the site at all?

When I used to run a number of ASP Classic sites I often turned them off for the five minutes required to do what I needed.

Rude to do to your visitors I know.

As others have said you could redirect to a page, but that won't stop people visiting static content in html pages, but then that probably won't matter, at least it stops them making changes to the mdb whilst you download it.

It's a pity that ASP.net's app_offline.htm doesn't work for ASP classic.

Another option I used to use was to create a default.htm file that had the offline message, and the way IIS was setup default.htm overrode default.asp, so simply uploading default.htm changed the homepage. This of course doesn't stop anyone using any of the other .asp pages.

So no real answer! Sorry.

Iain M Norman
A: 

Better than an include file, just use the Global.asa.

In the Global.asa's Application_onStart, add

Application("Offline")= True

at the top of all of your ASP files, add

If VarType(Application("Offline")) = vbBoolean Then If Application("Offline") Then Response.Redirect "App_Offline.htm"

(The double-if gets around the lack of VBScript's short-circuit operators, and therefore any data type errors.)

You could even set the Global.asa code to

Set fso= Server.CreateObject("Scripting.FileSystemObject")
Application("Offline")= fso.FileExists(Server.MapPath("App_Offline.htm"))
Set fso= Nothing

Which would enable the offline page if it exists, like ASP.NET. However, the application start code is only reparsed when the server is reset (using iisreset), or when the Global.asa file is modified, merely adding the App_Offline.htm will not be enough.

brianary