My problem is a bit complicated: I am writing in c#, asp.net and using jquery
- I have a page that sends requests to the server using jquery's ajax method.
- I have a ashx file (handler) to respond to these request.
- User can perform several changes on several pages, then use some method that will call the ajax method.
- My ashx file reads some values From the session variables and acts accordingly.
This works fine in all browsers but in internet explorer. In internet explorer the session seems to hold old information (old user ids'). It's incredible, the same code works fine in firefox, chrome and safari but fails with ie.
What could be causing it? I have no clue where to even start looking for a solution.
btw, Sorry for the general title, couldn't figure out how to explain in just few words.
Here are the jquery code and the 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);
}
});
}
Ashx
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;
}
Thank You!