调用asp.net 4.5 web服务返回302并重定向到默认页面 [英] Calling asp.net 4.5 web service returns 302 and redirects to default page

查看:45
本文介绍了调用asp.net 4.5 web服务返回302并重定向到默认页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$.ajax({
    type: "POST",
    async: false,
    url: url,
    data: dataParameters,
    contentType: "application/json; charset=utf-8",
    success: function (msg) {
        //
    },
    error: function (xhr, ajaxOptions, thrownError) {
        //
    }
});

在我的本地使用它时一切正常,但在主机上返回

when using this in my local everything is fine but on host its return

[HTTP/1.1 302 Found 278ms]

我的 WS 函数:

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string SomeFunction(int something) {
    //          
}

推荐答案

路线是我的问题.将此行添加到路由解决我的问题:

The route was my problem. adding this line to route solve my problem :

routes.Ignore("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });

这篇关于调用asp.net 4.5 web服务返回302并重定向到默认页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆