why Layout.cshtml will run lots of times?

mc 4,836 Reputation points
2023-08-31T02:55:49.02+00:00

I am using asp.net core web application

using a _Layout.cshtml in Index.cshtml

I write some code in _Layout.cshtml and add breakpoint. I find it will hit 10 or 8 times when I open the Index.cshtml

why?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,671 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 68,081 Reputation points
    2023-08-31T15:10:25.1566667+00:00

    Most likely you have src=“” on some img or link elements that re-fetch the page.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.