Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc 404 code error

I have project at asp.net mvc. And there is problem i dont know how to solve: I add at web.config error handling, and that is ok, but it's return

HTTP/1.1 302 Found
Content-Length: 157
Location: /Error404.html?aspxerrorpath=/fghdhdfghg

which is wrong, i need HTTP/1.1 404 Not Found. I have tested at

that site

Do you know how to set error code for my error404.html page? I have tryed both Hardcoded html page & MVC Action.

like image 736
SiarheiK Avatar asked Dec 01 '25 09:12

SiarheiK


1 Answers

You can set Response.StatusCode = 404 or you can return a HttpNotFoundResult from the controller.

like image 60
MarkG Avatar answered Dec 04 '25 19:12

MarkG