Originally, you only need to set the target framework of each project in Visual Studio 2012. net framewor 4.5, and then in the web. when the targetframework of compilation is set to 4.5 in config, It is upgraded to ASP. net 4.5.
<CompilationTargetframework= "4.5"/>
Later it was found that this was not enough. You also need to set the targetframework of httpruntime in Web. config.
<HttpruntimeTargetframework= "4.5"/>
In this way, it is truly upgraded to ASP. NET 4.5.
Note the following two points after the upgrade:
1. Machine Key settings in Web. config
The default settings for ASP. NET 4.5 are as follows:
<MachinekeyCompatibilitymode= "Framework45" />
ASP. NET 4.5 encryption/decryption of Form VerificationAlgorithmIf not all ASP. NET applications are added at the same timeProgramUpgrade to ASP. NET 4.5. to maintain the compatibility of Form Verification, You need to modify the compatibilitymode settings.
<MachinekeyCompatibilitymode= "Framework20sp1"/>
<MachinekeyCompatibilitymode= "Framework20sp2"/>
2. Impact on webforms form verification controls
If you use a verification control such as <asp: requiredfieldvalidator/>, the following error occurs:
Webforms unobtrusivevalidationmode requires a scriptresourcemapping for 'jquery '. Please add a scriptresourcemapping named jquery (case-sensitive ).
Solution: Add the following settings in <etettings> of Web. config:
<AddKey= "Validationsettings: unobtrusivevalidationmode"Value= "NONE" />
You will find out what you need to pay attention to when upgrading to ASP. NET 4.5. We look forward to sharing with you!
References:
All about
cryptographic improvements in ASP. NET 4.5