Primary Question
I have a single form which, depending on various underlying metadata will display different variations of a form. In a single case, only in the deployed application (works fine in dev and qa environments), one variant of the form causes a 500 Internal Server Error. I've examined the data sent back to the server in both the dev and live environments, and there's no difference at all.
The question is, how can I track down this 500 error? I have elmah installed, and its not getting tripped. I've set a Logging statement as the first action in my POST handler, and it never executes. I've set <customErrors mode="Off"/> in my web.config, and it doesn't show me a better error message. The only thing I can think of is that I have some kind of routing issue, but that doesn't really feel right since the same data works just fine to route for other servers.
So, what else can I do to track down this elusive bug?
Background Info
I have a reporting module in the app that I'm building, and it is metadata driven. Once they select which report they wish to execute, the software pulls up the metadata for the report, figures out what parameters need to be collected, and displays a form to gather them from the user. Once the user has filled out the form, they click a button, which submits the form via a jquery $.ajax() call. The controller should pick up the incoming form post, validate the form data, and then either re-display the form or return a json with a url to present the report renderer action.
Route Config
public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } Ajax Post Code
var ajaxUrl = this.action; var ajaxType = this.method; var ajaxData = $(this).serialize(); $.ajax({ url: ajaxUrl, type: ajaxType, data: ajaxData, success: function(result) { // did we get a JSON back from the server? if (typeof(result) === "object") { //deal with the return result... if (window.console) console.log("-- reportParam form submit passed validation"); $("#popupDialog").popup("close"); //need non-ajax version to go to url so we get a dom refresh - we want a new page also // window.location.href = window.open(result.URL, '_blank'); } else { if (window.console) console.log("-- reportParam form failed validation"); $('#popupDialog').html(result); $('#popupDialog').trigger('create'); var _RPT = RevTrak.Portal.Report; _RPT.Index.initBindings(); } }, complete: function() { if (window.console) console.log("-- paramEdit form submit ajax call complete"); //this indicates we passed validation }, error: function(xhr, textStatus, errorThrown) { var sErrMsg = ""; sErrMsg += "paramEdit form submit error "; sErrMsg += "\n\n" + " - textStatus :" + textStatus; sErrMsg += "\n\n" + " - Error Status :" + xhr.status; sErrMsg += "\n\n" + " - Error type :" + errorThrown; sErrMsg += "\n\n" + " - Error message :" + xhr.responseText; if (window.console) console.log(sErrMsg) alert(sErrMsg); } });
HTTP: 500is thrown when some interaction between client and server failed. if you tell me that it works everywhere else, then there must be a difference in code somewhere. i assume you parse the form in jQuery? in any case i would expect 404 error or some modifier issue (private/internal action)