0
我有一个jQuery的Ajax调用尝试调用webmethod。它适用于所有环境,但尚未部署到生产环境。唯一的区别是生产使用HTTPS SSL。通过https的Ajax呼叫SSL
这里是我的Ajax代码
$.ajax({
type: "POST",
url: "https://www.mywebsite.ca/assure/demandeconfirmee.aspx/EnvoyerAuxAssureurs",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: 'text',
success: function (msg) {
console.log(msg);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
}
});
和我的webmethod
[WebMethod]
public static string EnvoyerAuxAssureurs()
{
return "YanTest";
}
从事的是Ajax通过https应该直截了当没有?
对我测试的每个环境我收到“yanTest”作为回应。
<html><head><title></title><!-- <script language="javascript">window.location.replace("http://www.mywebsite.ca/assure/demandeconfirmee.aspx/EnvoyerAuxAssureurs");</script> --></head><body></body></html>
任何输入:
然而,在HTTPS(生产)我得到以下答案(被称为URL在comment..with HTTP来代替https返回)?
!!!问题解决!!!! 重定向是由导致重定向的WebPageSecurity.dll模块引起的,我将以下内容添加到了我的web.config中,它现在可以正常工作!
<secureWebPages mode="On" maintainPath="True" warningBypassMode="AlwaysBypass" bypassQueryParamName="BypassSecurityWarning" ignoreHandlers="WithStandardExtensions">
<files>
<add path="Assure/DemandeConfirmee.aspx/EnvoyerAuxAssureurs" secure="Ignore" />
</files>
是不是有任何重定向?这里没有标准问题。这是特定于您的基础结构的东西。 –
这是我的想法....但是我无法在框架中找到任何重定向....为什么它只能通过https执行此操作... –
也许是因为您尚未登录? – spender