1

I have pretty standard asp.net core 2 app. I debug from Visual Studio using IIS Express.

Why chrome repeats requests twice, when I enter the url, or refresh page?

enter image description here

second time without:

enter image description here

How do I avoid it?

csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
  </ItemGroup>
Liero
  • 25,216
  • 29
  • 151
  • 297
  • requests also have different `accept` headers. [This old post](https://stackoverflow.com/a/4941800) says that this may be due to favicon. If yes, this explains why the second request for image content. – Set Mar 24 '18 at 17:00
  • ok, I found out that some elements had style with `background-image:url()`, so that was the problem – Liero Mar 25 '18 at 14:42

1 Answers1

0

As @Set mentioned, the second request had different accept header. It looked like something was requesting image.

I've reviewed the generated source code and found something like this:

<span class="avatar" style="background-image:url()"></span>

which was doing request to current url.

Liero
  • 25,216
  • 29
  • 151
  • 297