I have an issue with my ashx handlers which are triggered via an update panel postback and a javascript call.
Long story short, there are two handlers in the application. Regardless of what URL I call, I always end up in the same handler (the older one) and never in the newer required one.
I can not figure how this can happen as the URL appears to be correct therefore I am leaning to a configuration issue.
Any ideas anyone - this is starting to fry my nut?
Cheers
Code below:
C#:
string encryptedQuerystring = StringFunctions.EncryptQueryString(string.Format("productId={0}", CurrentProduct.Id));
string js = "$(function () {ProductManager.ExportProductExcel('../../Handlers/ProductExportExcel.ashx" + encryptedQuerystring + "');});";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "GenerateProductExport", js, true);
Javascript:
ExportProductExcel: function (url) {
window.location = url;
alert(window.location);
Ok so this turned out to be a schoolboy error......
I had done a simply copy paste to create the new handler and edited all the code behind functionality. What I forgot however was that there is also a mark-up page associated with .ashx file which also needed editing.
<%@ WebHandler Language="C#" CodeBehind="ProductExportExcel.ashx.cs" Class="ITG.MediaCentre.Crew.WebApplication.Handlers.ExportExcel" %>
What you will notice is that the Class portion is pointing to the incorrect class hence the wrong code is executed even though the URL is pointing to the correct location.
Hope this helps somebody out in the future.
Cheers