配置 web.config 以允许来自远程源的 js
我有一个 login.aspx
,其中有一个 asp:Login
,现在在此页面中我想允许一些脚本,这些脚本被注入到我的应用程序的主控中。但是这个脚本不在本地路径中,而是在另一台服务器中,我知道这个脚本是否是本地的,我可以像这样配置,以允许在login.aspx页面中
<location path="scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
假设脚本位于本地文件夹样式中,我该如何配置修改或更改此配置以允许此路由中的脚本
<script src="http://Example/scripts/jquery.js" type="text/javascript"> </script>
我尝试过这样但它不起作用
<location path="http://Example/scripts/">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
I have a login.aspx
, which have a asp:Login
, now in this page i want to allow some scripts, which are injected in the master of my application. But this scripts are not in local path, but in another server, i know if this scripts are local i could configure like this, to allowed in the login.aspx page
<location path="scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
That assume that the scripts are in the local folder styles, how can i modifed or change this configure to allow the scripts that are in this route
<script src="http://Example/scripts/jquery.js" type="text/javascript"> </script>
I tried like this but it doesn't work
<location path="http://Example/scripts/">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它导致了问题,那么这是另一台服务器造成的。
这意味着您必须在托管 css 文件的服务器上创建授权异常,而不是在 *.aspx 引用该文件的服务器上创建授权异常。
If it causes the trouble then this is the other server which does so.
It means that you have to create the authorization exception on the server hosting the css file, not the one which has the *.aspx referencing it.