【发布时间】:2012-05-11 09:06:43
【问题描述】:
在我的 Sencha 触控应用中。我使用 .net 网络服务来获取 xml 格式的数据。 我使用 Ext.Ajaxrequest 调用它,如下所示
var frmurl ='http://Server/sencha/WS/web.asmx/GetData';
Ext.Ajax.request({
url: frmurl,
method: 'post',
params: {
whereCondition :WhereCond,
ReportName:rptname
},
success: function(Response) {
renderReport(Response.responseText,'1');
}
, failure: function (Response, request)
{
Ext.MessageBox.alert('Error, unable to load data');
} //</failure>
});
它工作正常并给我正确的结果,但我需要在 web.config 中添加以下标签以使其正常工作
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
但正因为如此,任何人都可以调用 webmethods,这是主要的安全问题。 如果我删除此标签,则无法调用 web 服务并给出内部服务器错误。
请帮助我。 谢谢
【问题讨论】:
-
您没有提到您实施了哪些身份验证方法(如果有)。如果您没有使用任何东西来保护 WS 端点,那么根据定义,任何知道 URI 的人都可以调用它。
-
只有在 web.config 中启用了 HTTP GET 和 HTTP POST 时,任何人都可以调用 Ws。因为默认情况下 HTTP GET 和 HTTP POST 都被禁用,因此在远程计算机上调用按钮将不存在。我的问题是我需要在我不想做的 web.config 中启用它
标签: asmx sencha-touch-2