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

Decrypt data encrypted with visual basic, I've some encrypted data list of ...

I've some encrypted data list of customers that are stored in a sql server db. These data are encrypted using visual basic, using a specific dll, from what I could see. The work

Need experienced outlook developer, Need Experienced Outlook (Microsoft Off...

Need Experienced Outlook (Microsoft Office) developer Your required skills: (1) A developer at heart, one that knows how to prepare modular, well-designed and clean code, (2) va

What is the use of the connection object, What is the use of the Connection...

What is the use of the Connection object? The Connection object is used to connect your application to a specific data source by giving the needed authentication information in

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

How is anchoring different from docking, How is anchoring different from do...

How is anchoring different from docking? Docking refers to attaching a control to either an edge (top, right, bottom, or left) or the client area of the parent control. On the

Import columns of data into data table for data grid view, Import Columns o...

Import Columns of Data into Data Table for Data Grid View in C# and WPF Need help with a project in C# / WPF. Trying to read a csv file or text file with columns of data that wi

Want c# single user login per session, Want C# Single User Login per sessio...

Want C# Single User Login per session Project Description: I need to save simulatenious logins for one account such as one user has a spottily premium account and someone tri

Payroll managment, how can i construct er diagram for payroll managment

how can i construct er diagram for payroll managment

Service oriented architecture, What is Service Oriented architecture? T...

What is Service Oriented architecture? The "Services" are the components which expose well defined interfaces and these interfaces communicate through XML messages. By Using th

Windows application for ildasm application, In this assignment you will cre...

In this assignment you will create a Windows application that mimic the ILDASM application. Your application should have at least the following features: 1. A multi-form applica

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