Sunday, 15 September 2013

json - How to get MVC action to return erroneous status -



json - How to get MVC action to return erroneous status -

here scenario, fetch info database, try/catch in controller action , pass code , error message js.

//in action [httppost] public jsonresult getworkorderdetails(string folderno) { try{ //do stuff - fetch info }catch() { //if error, set jsonresult homecoming bad status , error message } } //in js if(response.status == 400){ //if error, output message response.responsetext , homecoming }

any way set response status 400 within action in grab statement?

i alter homecoming type generic actionresult , when needed homecoming new httpstatuscoderesult.

json error-handling

No comments:

Post a Comment