c# - MVC Ajax.error render Partial View -


while working kendo ui grid asp.net mvc finding frustrating behavior can't seem understand or find information on. have grid makes kendogrid.savechanges() request server has server side validation. if server-side validation fails, returns following result:

response.statuscode = http_bad_client_request; // const int 400 return partialview("error/badrequest"); 

the partial view has basic html displaying error information user, , grid's datasource error callback following:

function errorcallback(e) {     // handles explicit ajax , kendo datasource error callbacks     var content = e.responsetext || e.xhr.responsetext;     // wrapper around kendo.ui.window display content     core.alert.raisealert(content); } 

when run project in debug mode, or publish release version of project local machine e.xhr.responsetext value populated correctly i.e. contains partial view's html message. however, move production server e.xhr.responsetext contains value "bad request" http status code using. i've tried using other status codes result same (error name used responsetext).

the reason find odd doing similar in project internal application @ our company , works fine. running on same versions , tools of both kendo , asp.net.

can point me in direct of tools or documentation, kendo or ajax, explain why response text not using partial view result or how can map partial view result sending xhr.responsetext property?

edit: trying different error codes, found status codes such 405 (not allowed) resulted in iis server error html being returned. i'm stumped, why status codes return name of request, while others return templated html error code when specifying return value , view return?

credit findings , solutions goes this post.

after doing digging, figured out issue came down iis overriding content (and therefore partial view) being sent when used error http status codes.

the solution add <httperrors> tag system.webserver in web.config. found following sufficient partial views reach client.

<system.webserver>     <httperrors existingresponse="passthrough" /> </system.webserver> 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -