我的网站上有一个私人区域,我在其中放置了一些文件(主要是档案)。只有注册用户才能下载这些文件。 文件被上传到文件夹/ writable / public / ...所以如果有人在地址栏www.mysite.com/writable/public / ...上写,这个人实际上可以下载文件。我想要获得的是将此尝试重定向到ASP classic中的登录页面。 我已经阅读过有关HTTPHandlers的内容,但是我已经了解它们适用于ASP.NET,而且我不知道如何在ASP classic中使用它们。
答案 0 :(得分:0)
<% const SESSION_USERNAME_KEY = "SK_Username"
sub CheckAccess(adminOnly)
'If the user has not logged in, or if the page is designated as Admin-only
'and the user is not the Administrator, redirects to the login page.
if Session(SESSION_USERNAME_KEY) = "" or (adminOnly and not IsAdmin()) then
Response.Redirect("userLogin.asp")
end if
end sub
call CheckAccess(false)
%>