Why does an actionlink in _Layout.cshtml that leads to nowhere report 500 Error instead of 404 File Not Found?

1

When deploying a website via Azure web apps. I created an empty action link in _Layout.cshtml as such:<li>@Html.ActionLink("Crash", "Crash", "Home")</li>.

In Views/Home which is where all the cshtml files are stored, I did not create a specific cshtml file for Crash.

After finishing my deployment, I went to the website and clicked on Crash as it's one of the available tabs. This led to a 500.0 Internal Server Error.

I am unfamiliar with the error codes and what they represent. So I was confused as to why it threw a 500 instead of 404 File Not Found. My thought process was that if the action link leads to nowhere, then the server cannot find that corresponding file that can be served, hence it should prompt File Not Found.

Here is the detailed error information

Module             ManagedPipelineHandler
Notification       ExecuteRequestHandler
Handler            System.Web.Mvc.MvcHandler
Error Code         0x00000000
Requested URL      https://testurltesturlfake:80/Home/Crash
Physical Path      C:\home\site\wwwroot\Home\Crash
Logon Method       Anonymous
Logon User         Anonymous

But it's giving a 500, why?

http
razor
http-status-code-404
azure-web-app-service
http-status-code-500
asked on Stack Overflow Aug 24, 2020 by 2Xchampion

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0