通过在web.config文件中指定位置路径,可以为每个页面独立处理网页授权。在我的应用程序中,我还有一个主页,所有用户都可以访问该主页,而对于其他页面,则完成授权。我是通过使用下面的web.config文件来实现的。下面的web.config文件被添加到我需要授权的每个页面的组件文件夹中,至于主页,由于我不对主页的用户进行身份验证,因此没有web.config文件。
web.config
<configuration>
<system.web>
<authorization>
<allow roles="BUILTIN\Administrators" />
<deny users="?" />
</authorization>
</system.web>
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true" />
<basicAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</configuration>
现在我想知道是否存在使用web.config验证按钮/方法调用的类似方法?因为在我所有用户都可以访问的主页中,我有一个按钮,请单击该按钮以安装哪个msi页面。我的html和js文件如下所示。
home.html
<div class="home-content" ng-controller="homeController as vm">
<table style="width:100%; height:100%;">
<tr>
<td style="vertical-align:middle;">
<div style="padding-left: 15px; padding-top: 12px;">
<img src="app/assets/img/star.png" />
</div>
</td>
<td>
<p align="center" style="min-width:384px;">
<a href="{{vm.msiDownload}}" class="btn-download" download="" style="text-decoration: none;padding: 12px 32px;">
Install DC <i class="fa fa-download" aria-hidden="true" style="padding-right: 32px;"></i>
</a>
</p>
</td>
</tr>
</table>
</div>
Home.js
(function () {
angular.module('dcApp').controller('homeController', function (DC_CONSTANTS) {
var vm = this;
InstallationClick = DC_CONSTANTS.baseURL;
clientMsi = window.location.host;
vm.msiDownload = DC_CONSTANTS.baseURL + "DC_" + clientMsi + ".msi";
});
})();
这是下载msi文件“ DC_CONSTANTS.baseURL +“ DC_” + clientMsi +“ .msi”;“的URL。 可以使用web.config对其进行身份验证吗?如果不使用web.config,该如何处理?
我对此并不陌生,自2天以来我一直在谷歌上搜索,但没有找到解决方法。请帮我。