Code for the file dependency in cache, DOT NET Programming

Assignment Help:

Show the code for the file dependency in cache?

Partial Class

Default_aspx

Public Sub displayAnnouncement() Dim announcement As String

If Cache("announcement") Is Nothing Then

Dim file As New _ System.IO.StreamReader _

(Server.MapPath("announcement.txt")) announcement = file.ReadToEnd file.Close()

Dim depends As New _ System.Web.Caching.CacheDependency _

(Server.MapPath("announcement.txt")) Cache.Insert("announcement", announcement, depends)

End If

Response.Write(CType(Cache("announcement"), String)) End Sub

Private Sub Page_Init(ByVal sender As Object, ByVal e As

System.EventArgs) Handles Me.Init displayAnnouncement()

The Above given process display Announcement () displays banner text from the Announcement.txt file that is lying in  the application path of the web directory. The Above method first checks whether the Cache object is nothing, if the cache object is nothing then it moves further to load the cache data from the file. When the file data changes the cache object is removed and set to nothing.


Related Discussions:- Code for the file dependency in cache

I want a c# school project, I want a C# school project Project Descripti...

I want a C# school project Project Description: The project is made in C# and haves a database connection. We have some small problems asking up data from the database.

I need a custom project - c# developer, Project Description: My project ...

Project Description: My project is to construct for me an application that emulates the http requests made in a webapp. It will need a lot of dedication and skill in C#,.net,

Define passport authentication, Passport Authentication This is a centr...

Passport Authentication This is a centralized authentication service given by Microsoft that offers a single logon facility and membership services for participating sites. ASP

Globalization, how to access global resource file using javascript

how to access global resource file using javascript

Locate bug in website, Locate BUG website Project Description: Can yo...

Locate BUG website Project Description: Can you find a bug in easports fifa 14 ultimate team web app (easports/fifa/football-club/ultimate-team) so that i will earn a lot of

Explain manifest, What is Manifest? Assembly metadata is keeps in Manif...

What is Manifest? Assembly metadata is keeps in Manifest. Manifest contains all the metadata required to do the following things     Version of assembly.     Security ide

Current culture of the environment in windows and asp.net, How we get the c...

How we get the current culture of the environment in windows and ASP.NET? The "CultureInfo.CurrentCulture" represents the current culture of the environment. For illustrate if

We need long term kentico developer, We need Long term Kentico developer ne...

We need Long term Kentico developer needed I want a solid Kentico developer that I can rely on to handle overflow work. Usually this will include about 5 hours of work each week

What are the improvements made in cas in .net 4.0, What are the improvement...

What are the improvements made in CAS in .NET 4.0? The CAS mechanism in .NET is used to control and configure the ability of managed code. Previously, as this policy was applic

What is data independence, What is Data Independence? Data independenc...

What is Data Independence? Data independence means that "the application is independent of the storage structure and access method of data". In other words, the ability to cha

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd