Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# https SSL上的Ajax调用_C#_Ajax_Https - Fatal编程技术网

C# https SSL上的Ajax调用

C# https SSL上的Ajax调用,c#,ajax,https,C#,Ajax,Https,我有一个jquery Ajax调用,试图调用webmethod。它适用于所有环境,但一次部署到生产环境就不行了。唯一的区别是生产使用HTTPS SSL 这是我的ajax代码 $.ajax({ type: "POST", url: "https://www.mywebsite.ca/assure/demandeconfirmee.aspx/EnvoyerAuxAssureurs", data: "{}", contentType: "

我有一个jquery Ajax调用,试图调用webmethod。它适用于所有环境,但一次部署到生产环境就不行了。唯一的区别是生产使用HTTPS 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";
}
通过https实现ajax应该是直截了当的不

在我测试它的每个环境中,我都会收到“yanTest”作为回应

但是,在https(生产)下,我得到以下答案(在注释中返回名为url的..使用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>
    <secureWebPages mode="On" maintainPath="True" warningBypassMode="AlwaysBypass" bypassQueryParamName="BypassSecurityWarning" ignoreHandlers="WithStandardExtensions">
<files>
    <add path="Assure/DemandeConfirmee.aspx/EnvoyerAuxAssureurs" secure="Ignore" />
</files>


!!!问题解决了!!!!重定向是由导致重定向的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>
    <secureWebPages mode="On" maintainPath="True" warningBypassMode="AlwaysBypass" bypassQueryParamName="BypassSecurityWarning" ignoreHandlers="WithStandardExtensions">
<files>
    <add path="Assure/DemandeConfirmee.aspx/EnvoyerAuxAssureurs" secure="Ignore" />
</files>


是否有任何重定向?这里没有标准问题。这是你的基础设施的特殊之处。这就是我所想的。。。。但是,我在框架中找不到任何重定向。。。。为什么它只能在https上这样做…可能是因为你没有登录?我可以只为https添加重定向规则。你为什么不查看浏览器开发工具或Fiddler来查看该请求的详细流量?是的,我已经检查了“charles proxy”来查看流量,在chrome developer(XHR请求)中,我看到请求是“200 ok”,但返回没有意义。我在webmethod中添加了一个记录器,没有任何日志记录。我的WebMethod从未被调用。。。。。我会花一些时间来研究一些可以重定向我请求的东西。唯一可能导致这种情况的模块是“webPageSecurity.dll”,这是一个在internet上找到的库,我无法控制它。同样,只有在HTTPS/SSL环境之后,才会发生此问题。在其他地方,它的工作正如预期的那样