iis无法启用ajax,Ajax,vs2010中通常,iis中不能运行

当前位置:我的异常网» .NET新技术 » Ajax,vs2010中通常,iis中不能运行

Ajax,vs2010中通常,iis中不能运行

www.myexceptions.net  网友分享于:2015-03-10  浏览:0次

Ajax,vs2010中正常,iis中不能运行。

ajax代码:

$.ajax({

url: "/Account/LogOnAjax/",

type: "POST",

data: {

UserName: c,

Password: d,

RememberMe: $("#ustate").attr("checked")

},

dataType: "json",

timeout: 6e4,

cache: false,

success: function (c) {

if (c.result) {

alert("111");

a.login_success(b, c.info);

}

else {

alert("222");

a.tipMsg_cont("账号或密码不太对吧! 重试一次?");

a.tipMsg_show(b);

a.elem_text_upawd.select();

a.login_submit_set({

is提交状态: false,

is提交按钮: true,

is对话框按钮: true,

is可点击链接: true

})

}

},

error: function (d, c) {

a.login_submit_set({

is提交状态: false,

is提交按钮: true,

is对话框按钮: true,

is可点击链接: true

});

switch (c) {

case "timeout":

a.tipMsg_cont('对不起!登录已超时,重新登录');

a.tipMsg_show(b)

}

}

})

============================================================

AccountController中代码:

[HttpPost]

public JsonResult LogOnAjax(LogOnModel model)

{

//如果用户名与密码都不为空

if (ModelState.IsValid)

{

用户 userInfo = null;

/* 验证用户登录 */

int returnValue = MembershipService.ValidateUser(model.UserName, model.Password, out userInfo);

#region 处理返回值

/* 编号不存在 */

if (returnValue == 1)

{

return LKPageJsonResult.Failure("用户名不存在,请重新输入");

}

/* 密码错误 */

else if (returnValue == 2)

{

return LKPageJsonResult.Failure("密码错误,请重新输入");

}

else

{

//保存cookie

FormsService.SignIn(userInfo, model.RememberMe);

return LKPageJsonResult.Success(new { uname = userInfo.姓名, uemail = userInfo.邮箱, uguid = userInfo.ID });

}

#endregion

}

else

{

return LKPageJsonResult.Failure("请输入您的用户名或密码");

}

}

------解决思路----------------------

如果是IIS7的话 好像是需要webserve的吧

请打开webconfig最下面..

找到handdle

------解决思路----------------------

打开Chrome或者FireBug,里面会有ajax的请求信息,先分析是什么样的错误。

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值