473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Preserving data within a whole application.

I just recently recieved my full copy of Visual Studio 2005
(excited!!!), and have gone head first into writing my first
application.

Sadly, I've hit a design barrier.
From what I can see, ASP.NET 2.0 has no facility that is instantiated

upon deploying an application - similar to servlets. I don't really
need the functionality of a servlet, but what I am interested in
getting is an "always on" class that exists between different requests
between different ASP.NET classes.

My first instinct is to create some static monster class that has all
my functionality and that will persist for the duration of the whole
ASP.NET application's life. Although something in my gut tells me that
static classes are not to be abused in such a way.

Does ASP.NET provide me with anything that I can use to share
information between aspx pages and web service classes? On top of
that, what would be the best way to write a totally non-visual class
that is responsible solely for my "business logic"? The idea is that
after writing this omnipresent workhorse class, I'll use aspx pages,
web service pages and anything else to make use of the same set of data
without having to hit a database for small tidbits of session data.

(I'm writing a very simple user login system, and while I'm aware of
ASP.NET's built in user handling, I would like to write my own system
and then work it into ASP.NET's system afterwards.)

Apr 29 '06 #1
4 1216
You aren't actually looking for servlet functionality but application level
state? Cache or Application could help with that

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Omega" <at******@gmail.com> wrote in message
news:11*********************@y43g2000cwc.googlegro ups.com...
I just recently recieved my full copy of Visual Studio 2005
(excited!!!), and have gone head first into writing my first
application.

Sadly, I've hit a design barrier.
From what I can see, ASP.NET 2.0 has no facility that is instantiated

upon deploying an application - similar to servlets. I don't really
need the functionality of a servlet, but what I am interested in
getting is an "always on" class that exists between different requests
between different ASP.NET classes.

My first instinct is to create some static monster class that has all
my functionality and that will persist for the duration of the whole
ASP.NET application's life. Although something in my gut tells me that
static classes are not to be abused in such a way.

Does ASP.NET provide me with anything that I can use to share
information between aspx pages and web service classes? On top of
that, what would be the best way to write a totally non-visual class
that is responsible solely for my "business logic"? The idea is that
after writing this omnipresent workhorse class, I'll use aspx pages,
web service pages and anything else to make use of the same set of data
without having to hit a database for small tidbits of session data.

(I'm writing a very simple user login system, and while I'm aware of
ASP.NET's built in user handling, I would like to write my own system
and then work it into ASP.NET's system afterwards.)

Apr 29 '06 #2
Neato, how would I go about making use of that?

Where in my application can I have my workhorse class instantiated
before any requests are made? Should I just write a singleton that
stores it's reference in the cache or Application?

Keep in mind, I want this object to exist for every page and web
service in my program. It must exist across page loads, across page
types and across users. I want all that information to be preserved
even after the page has been rendered and sent out to the user.

Apr 29 '06 #3
That is Application or Cache, both are application wide. Difference is that
Cache supports all sorts of dependencies where cached data can be stalled
when for example a file or other cache item, (in ASP.NEt v2 also data in
database) changes while Application is just static. You could initialize
them in global.asax in Application_Start event which runs once when app
starts. Or you could do it in lazy way when first request for the data comes
in. It's up to you.

On Page you have Cache and Application properties available as is. Like

Application["key"] = obj;
object obj = Application["key"];

//And same with cache plus a few overloads of Insert method

In web service you access cache with Context.Cache or just HttpRuntime.Cache
(Application is as-is). In case you want to be sure about accessing even
without request context you could use HttpRuntime.Cache

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Omega" <at******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Neato, how would I go about making use of that?

Where in my application can I have my workhorse class instantiated
before any requests are made? Should I just write a singleton that
stores it's reference in the cache or Application?

Keep in mind, I want this object to exist for every page and web
service in my program. It must exist across page loads, across page
types and across users. I want all that information to be preserved
even after the page has been rendered and sent out to the user.

Apr 29 '06 #4
You Finnish folk rock my small Canadian world. One of my favourite all
time teachers from high school is a Finnish dude.

Thank you so much for the help!

Apr 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Karl | last post by:
This might not really be a javascript question, but I'll start with this group. At http://www.gazingus.org/ there is a very nice collapsible menu written using CSS and Javascript >>>> Using...
8
by: Jerry | last post by:
I have an off-the-shelf app that uses an Access database as its backend. One of the tables contains a field with an "OLE Object" datatype. I'm writing some reports against this database, and I...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
5
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character...
9
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo...
2
by: Clive Green | last post by:
Hello peeps, I am using PHP 5.2.2 together with MP3_Id (a PEAR module for reading and writing MP3 tags). I have been using PHP on the command line (Mac OS X Unix shell, to be precise), and am...
3
by: sophia.agnes | last post by:
Dear all, I was going through the book "C a software engineering approach by darnell & Margolis" there was a section named sign preserving vs value preserving it is as follows sign...
9
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all On SQL Server tables I use SqlDataReader to query data like "SELECT * FROM table". Is there something similar for XML Files ? I want to use SQL Syntax like "SELECT * FROM table" on a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.