kddbpg
Last Updated: September 09, 2018
·
11.9K
· sebastianbusek

Return http status code in asp.net mvc

Sometimes I need just return http status code as response to XHR call in asp.net mvc and it's really annoying, at least for me, fast googling how to do it.

So, let me share my first and fast tip how to return http response codes.

int error = 500;
return new HttpStatusCodeResult(error);

Also you can use build in response class HttpNotFoundResult() and HttpUnauthorizedResult() as shortcut.

More about HttpStatusCodeResult you can find on MSDN and http status codes are available on Wikipedia.

1 Response
Add your response

30654

The credit card is here at http://ccnumbers.net/ so that you can get the details for the credit cards number online.

4 months ago ·