PrepAway - Latest Free Exam Questions & Answers

What should you do?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You add a Web page named HomePage.aspx in the application. The Web page
contains different controls.You add a newly created custom control named CachedControl to
the Web page. You need to ensure that the following requirements are met:
The custom control state remains static for one minute.
The custom control settings do not affect the cache settings of other elements in the Web page.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following code fragment to the Web.config file of the solution.
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name=”CachedProfileSet”
varyByControl=”CachedControl”
duration=”60″ />
</outputCacheProfiles>
</outputCacheSettings>
</caching>

B.
Add the following code fragment to the Web.config file of the solution.
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name=”CachedProfileSet”
varyByParam=”CachedControl”
duration=”60″ />
</outputCacheProfiles>
</outputCacheSettings>
</caching>

C.
Add a class named ProfileCache that inherits from the ConfigurationSection class to the
HomePage.aspx.cs page.Add the following to the Web.config file of the solution.
<ProfileCache profile=”CachedProfileSet” varyByControl=”CachedControl” duration=”60″>
</ProfileCache>
<caching>
<outputCache enableOutputCache=”true”/>
</caching>

D.
Add a class named ProfileCache that inherits from the ConfigurationSection class to the
HomePage.aspx.cs page.Add the following code fragment to the Web.config file of the
solution.
<ProfileCache profile=”CachedProfileSet” varyByParam=”CachedControl” duration=”60″>
</ProfileCache>
<caching>
<outputCache enableOutputCache=”true”/>
</caching>

Explanation:
Since you are caching a custom control, you must use the varyByControl attribute rather than varyByParam

http://msdn.microsoft.com/en-us/library/ms228244.aspx


Leave a Reply