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

Named pipe in matlab, What I need is the following: I need an implementatio...

What I need is the following: I need an implementation in matlab under windows to open a named pipe and to read data from the pipe (an other program writes into the pipe) in quasi

Prepare an application in c# or c++, Prepare an Application in C# or C++ ...

Prepare an Application in C# or C++ Project Description: We are seeking someone who can write a program in C# or C++. The concept is to develop the program using a Cross P

How to load multiple tables in data set?, How can we load multiple tables i...

How can we load multiple tables in a DataSet? objCommand.CommandText = "Table1" objDataAdapter.Fill(objDataSet, "Table1") objCommand.CommandText = "Table2" o

I want simple code for outlook, I want simple code for Outlook (express,200...

I want simple code for Outlook (express,2003,2007,2010,2013) Add-In with functionality to routinely send CC to the specified email(s), this system should have -Code for every th

Project spending, Is spending in projects constant throughout the project? ...

Is spending in projects constant throughout the project? Generally in initial stage of projects (design and requirement phase) the cost is very less (as you require maximum bus

What are the naming conventions required for xml elements, What are the nam...

What are the naming conventions required for XML elements tags? The following are the naming conventions that need to be followed for XML elements tags: Element names should

Demonstrating boxing and unboxing - c# program, Demonstrating Boxing and Un...

Demonstrating Boxing and Unboxing - C# Program Hi, Can any of you, tell me how to use boxing and Unboxing in c#?

Set up a ftp file server and active ftp file transfer, Set up a FTP File Se...

Set up a FTP File Server and active FTP File Transfer using VB.NET The Job Description is as given: 1. Manually set up a FTP file server on a remote server. 2. Manually ad

Program, finding greatest of n no''s in c#

finding greatest of n no''s in c#

Accepting a list of 5 items - c# program, Accepting a List of 5 Items - C# ...

Accepting a List of 5 Items - C# Program Hello, I've been trying so many codes for this but those codes didn't work well. Please write the code for Accepting a List of 5 Items

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