经典ASP“向下维护”页面

时间:2023-01-05 01:34:27

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.

我正在对传统的经典ASP应用程序进行一些更改。我已在本地进行了更改,现在我想将更改的文件复制到服务器。同时,我需要下载Access数据库,在某些表中添加一些字段,然后重新上传。出于这个原因,我需要能够阻止访问者在发生这种情况时修改数据库。

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.

我的第二个问题(也许这应该是一个单独的问题):是否有更好的方法将字段添加到db表而不是将其复制,修改并再次粘贴?请原谅,如果这是一个愚蠢的问题 - 我是ASP的新手 - 也是Windows新手。

I only have FTP access to the remote server.

我只有FTP访问远程服务器。

Thanks.

6 个解决方案

#1


2  

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.

如果您只有FTP访问服务器(并且无法控制IIS),只需将response.redirect插入所有asp页面顶部的“down for maintenace”页面,并在更新完成后将其删除。

The changes to the database can be performed with the ALTER TABLE statement.

可以使用ALTER TABLE语句执行对数据库的更改。

#2


4  

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

如果您在每个asp页面中执行服务器端包含,则可以在/upgrading.html中执行response.redirect

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.

在global.asa中,您可以在启动事件的会话中执行response.redirect。这可能是最好的方式。仅适用于.asp页面,而不是客户端来到.html页面。

#3


3  

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.

当我以前经常运行一些ASP Classic网站时,我常常将它们关闭五分钟,以满足我的需求。

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.

正如其他人所说,你可以重定向到一个页面,但这不会阻止人们访问html页面中的静态内容,但那可能无关紧要,至少它会阻止他们在下载时对mdb进行更改。

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

遗憾的是ASP.net的app_offline.htm对ASP经典不起作用。

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.

我以前使用的另一个选项是创建一个具有脱机消息的default.htm文件,以及IIS的设置方式default.htm overrode default.asp,所以只需上传default.htm即可更改主页。这当然不会阻止任何人使用任何其他.asp页面。

So no real answer! Sorry.

所以没有真正的答案!抱歉。

#4


0  

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.

关于“Down Maintanance”页面问题,如果每个页面中都有一个包含文件(对于标题),您可以将map.的思想放在另一个文件中,将Response.Redirect放在该文件中并将其上传到地点。这样可以避免对所有页面进行更改。

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.

另一种选择是上传一个由IIS首先找到的临时html文件。在IIS中,您可以设置在域/文件夹中查找哪个页面name.ext。例如,当您浏览到www.example.com时,您没有指定要查找的页面,因此可以根据设置加载index.html或index.htm。它取决于你的主机配置设置,但有点试验和错误我相信你可以找出他们使用的是哪一个。 IIS的常见内容是default.htm,default.html,index.html和index.htm。然后,您可以将它放在网站的每个文件夹中(我不知道),然后进行维护。

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 :-)

更新数据库时,您可以运行用sql编写的迁移脚本来更新数据库的模式和数据。由于您只有FTP访问权限,因此需要某种页面才能将sql粘贴到其中并运行。然而,这会打开安全问题,因此下载数据库,进行更改然后再次上载可能更容易。除了这样做你还可以保存文件,你将有一个备份:-)

Hope this helps.

希望这可以帮助。

#5


0  

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

比包含文件更好,只需使用Global.asa即可。

In the Global.asa's Application_onStart, add

在Global.asa的Application_onStart中,添加

Application("Offline")= True

at the top of all of your ASP files, add

在所有ASP文件的顶部,添加

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.)

(双重如果绕过缺少VBScript的短路运算符,因此任何数据类型错误。)

You could even set the Global.asa code to

您甚至可以将Global.asa代码设置为

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.

这将启用脱机页面(如果存在),如ASP.NET。但是,仅在重置服务器时使用iisreset重新启动应用程序启动代码,或者修改Global.asa文件时,仅添加App_Offline.htm是不够的。

#6


0  

Add below code in web.config <?xml version="1.0"?> <configuration> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>

在web.config中添加以下代码

And place app_offline under root folder. This will work.

并将app_offline放在根文件夹下。这会奏效。

#1


2  

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.

如果您只有FTP访问服务器(并且无法控制IIS),只需将response.redirect插入所有asp页面顶部的“down for maintenace”页面,并在更新完成后将其删除。

The changes to the database can be performed with the ALTER TABLE statement.

可以使用ALTER TABLE语句执行对数据库的更改。

#2


4  

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

如果您在每个asp页面中执行服务器端包含,则可以在/upgrading.html中执行response.redirect

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.

在global.asa中,您可以在启动事件的会话中执行response.redirect。这可能是最好的方式。仅适用于.asp页面,而不是客户端来到.html页面。

#3


3  

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.

当我以前经常运行一些ASP Classic网站时,我常常将它们关闭五分钟,以满足我的需求。

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.

正如其他人所说,你可以重定向到一个页面,但这不会阻止人们访问html页面中的静态内容,但那可能无关紧要,至少它会阻止他们在下载时对mdb进行更改。

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

遗憾的是ASP.net的app_offline.htm对ASP经典不起作用。

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.

我以前使用的另一个选项是创建一个具有脱机消息的default.htm文件,以及IIS的设置方式default.htm overrode default.asp,所以只需上传default.htm即可更改主页。这当然不会阻止任何人使用任何其他.asp页面。

So no real answer! Sorry.

所以没有真正的答案!抱歉。

#4


0  

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.

关于“Down Maintanance”页面问题,如果每个页面中都有一个包含文件(对于标题),您可以将map.的思想放在另一个文件中,将Response.Redirect放在该文件中并将其上传到地点。这样可以避免对所有页面进行更改。

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.

另一种选择是上传一个由IIS首先找到的临时html文件。在IIS中,您可以设置在域/文件夹中查找哪个页面name.ext。例如,当您浏览到www.example.com时,您没有指定要查找的页面,因此可以根据设置加载index.html或index.htm。它取决于你的主机配置设置,但有点试验和错误我相信你可以找出他们使用的是哪一个。 IIS的常见内容是default.htm,default.html,index.html和index.htm。然后,您可以将它放在网站的每个文件夹中(我不知道),然后进行维护。

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 :-)

更新数据库时,您可以运行用sql编写的迁移脚本来更新数据库的模式和数据。由于您只有FTP访问权限,因此需要某种页面才能将sql粘贴到其中并运行。然而,这会打开安全问题,因此下载数据库,进行更改然后再次上载可能更容易。除了这样做你还可以保存文件,你将有一个备份:-)

Hope this helps.

希望这可以帮助。

#5


0  

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

比包含文件更好,只需使用Global.asa即可。

In the Global.asa's Application_onStart, add

在Global.asa的Application_onStart中,添加

Application("Offline")= True

at the top of all of your ASP files, add

在所有ASP文件的顶部,添加

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.)

(双重如果绕过缺少VBScript的短路运算符,因此任何数据类型错误。)

You could even set the Global.asa code to

您甚至可以将Global.asa代码设置为

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.

这将启用脱机页面(如果存在),如ASP.NET。但是,仅在重置服务器时使用iisreset重新启动应用程序启动代码,或者修改Global.asa文件时,仅添加App_Offline.htm是不够的。

#6


0  

Add below code in web.config <?xml version="1.0"?> <configuration> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>

在web.config中添加以下代码

And place app_offline under root folder. This will work.

并将app_offline放在根文件夹下。这会奏效。