compilation vs. httpRuntime for targetFramework in web.config
<compilation targetFramework="4.5" />
Selects which version of the .NET Framework’s reference assemblies are used when performing compilation. (Note: Visual Studio requires that this element be present in Web.config, even though we auto-infer it.)
<httpRuntime targetFramework="4.8" />
The reason of targetFramework existence in web.config is to keep compatibility issues out between breaking changes for each version of .NET Framework. The difference between targetFramework on compilation and httpRuntime belongs to each development and deployment environment.