Using MVC Razor I have a very simple test. The "logger" writes messages to a log file
TestController.cs
public ActionResult Index()
{
logger.Trace("Test Index Called");
return View();
}
Index.cshtml
<html>
<head><title>Testing</title></head>
<body><h3>This is a test</h3></body>
</html>
global.asax.cs
routes.MapRoute(
"Default",
"{controller}/{action}",
new { action = "Index" }
);
When I run the code, the log file shows this:
2011-12-15 10:16:09.4475: Test Index Called
2011-12-15 10:16:09.4475: Test Index Called
Notice that the timestamp for both calls are at exactly the same time? I've eliminated the issue where people have said that empty src attributes on a image tag and/or javascript functions not returning.
I've made this as simple as I possibly can - but the index action is being called twice in rapid succession.
Help?
Are you 100% sure that it's not the logger that writes two entries for each call? (For instance if you have configured two filters for the same logging target)
It's highly unlikely that ASP.NET can process the same action two times at the exact same millisecond.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With