我的问题有点复杂:
我用c_,asp.net编写并使用jquery
-
我有一个页面发送请求到
使用jquery的ajax的服务器
方法。
-
我有一个ashx文件(处理程序)要
响应这些请求。
-
用户可以对
几页,然后用一些方法
这将调用ajax方法。
-
我的ashx文件从
会话变量和行为
因此。
这在除Internet Explorer之外的所有浏览器中都可以正常工作。
在Internet Explorer中,会话似乎包含旧信息(旧用户ID)。令人难以置信的是,同样的代码在firefox、chrome和safari中运行良好,但在ie中失败了。
是什么引起的?我不知道从哪里开始寻找解决办法。
顺便说一句,对不起,总标题,不知道如何解释,只有几个字。
以下是jquery代码和ashx:
JQuery
function SendRequstToServer(actionId, additional, callback) {
if (actionId == "-1") {
document.location = "default.aspx";
}
$.ajax({ url: "SmallRoutinesHandler.ashx", method: "GET",
//asyn: false,
data: "Action=" + actionId + additional,
contentType: "string",
error: function(xhr, status, errorThrown) {
alert(errorThrown + '\n' + status + '\n' + xhr.statusText);
},
success: function(data) {
alert(data);
callback(data);
}
});
}
阿什克斯
context.Response.ContentType = "text/plain";
action = context.Request.QueryString["Action"];
switch ((ClientSideActionsRequest)Enum.Parse(typeof(ClientSideActionsRequest), action))
{
case ClientSideActionsRequest.ShowProducts:
long userId = WebCommon.CurrentlyWatchedUser.Id;
List<UserItems> userItems = UserItems.GetByUserId(userId);
string[] items = HtmlWrapper.WrapAsItems(userItems);
if (items.Length > 0)
{
context.Response.Write(items.Aggregate((current, next) => string.Format("{0} , {1}", current, next)));
}
break;
}
谢谢您!