asp.net mvc 2 - What HTTP status code should be returned when given an invalid ID? -


what status code should returned request delete object doesn't exist?

public contentresult deleteentity(int id, formcollection formdata) {     database db = new database();     targetentity te = db.targetentities.singleordefault(t => t.id == id);     if(te == null)     {         reponse.statuscode = 400; //is correct?         return content("deletion failed. invalid id: " + id);     }     //delete entity     return content("successfully deleted"); } 

the request fine, happens specified id invalid (or item deleted), i'm unsure 400 range. i'm pretty sure 500 codes less-suited this, since nothing went wrong on server (it asked delete doesn't exist).

what status code appropriate here?

what status code should returned request delete object doesn't exist?

404 - not found


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -