I am working in ASP.NET MVC. I am using partial views, but when I clicked on particular link I got the following error.
500 Internal Server Error
I got more details of the error from windows event viewer(Run>eventvwr.msc>Windows Logs>Application). Check the warnings/errors recorded from w3wp.exe
In my case the reason was missing dlls. Hope this helps
500 Server error means that a script has thrown an error, this is not a broken link (aka a 404 error).
If you are using Internet Explorer, go to tools > options > advanced
and unselect friendly http errors
, this will give you a more comprehensive description of the error so you can debug the script, or contact the relevant people to debug it.
To check what causes Internal Server 500 Error under ASP MVC you can also run your app in debug mode and check property AllErrors.
The property is an array of Exception type elements.
To do this open Global.asax.cs
(C#) and in the body of class MvcApplication
put method Application_EndRequest
:
protected void Application_EndRequest()
{ //here breakpoint
// under debug mode you can find the exceptions at code: this.Context.AllErrors
}
Then set breakpoint and check contents of the array: this.Context.AllErrors
It helped me to resolve what exception was thrown and optionally to see the stacktrace.
Though a little late, the Anti-Forgery token blocks the request as a security measure.
Removing all those anti-forgery tags in .cshtml and controller, removed the error for me.
Though if you want to keep those tokens successfully use this link:- http://iamdotnetcrazy.blogspot.com/2013/08/how-to-solve-anti-forgery-token-could.html