Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Web application design question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Moyles - 23 Dec 2007 11:27 GMT
I am a developer with many years (approx 10years) development experience
using C++ for DESKTOP applications. I am writing a web application using
C#, and I wanted to ask a question about appropriate design.

My design is as follows:

I have an Application class, which delegates to various classes to
perform required functionality. The application class is responsible for
the following:

Authentication
Authorization
UserManagement
SystemAdmin

etc.

Because of the nature of the work that the Application class does, there
should not be more than one instance of it at any given time - since
both instances for example, may try to modify/save the same object to
database.

I was therefore thinking of implementing the Application class as a
Singleton. But then I rembered that a web application is different from
a desktop application, because you have several users requiring
authentication/authorisation etc at the same time - so maybe a Singleton
pattern would not be appropriate for web applications.

Even if I used a Singleton pattern - is the single instance restricted
to a particular users session - or does it apply server wide - i.e.
accross all sessions?

Any help and insight from experienced web application designers would be
much appreciated.
Eliyahu Goldin - 23 Dec 2007 12:38 GMT
Why don't you just use existing asp.net classes found in the
System.Web.Security namespace?

If you want to wrap them into your code, you can make a set of classes that
we handle all these aspects based on the existing classes, like
securityManager, userManager etc, and all your pages will use these classes.

If you want to share these classes between several applications, make them
in a separate project as a class library and include it to different
applications.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I am a developer with many years (approx 10years) development experience
>using C++ for DESKTOP applications. I am writing a web application using
[quoted text clipped - 29 lines]
> Any help and insight from experienced web application designers would be
> much appreciated.
vapor - 24 Dec 2007 15:11 GMT
I agree here. In addition, Singletons on the web are exceedingly difficult
to create especially across a server farm - throw in web gardens and it
becomes an expensive approach.

Signature

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99

> Why don't you just use existing asp.net classes found in the
> System.Web.Security namespace?
[quoted text clipped - 42 lines]
>> Any help and insight from experienced web application designers would be
>> much appreciated.
Coskun SUNALI [MVP] - 24 Dec 2007 23:25 GMT
Hi Frank,

First of all, I would like to say that I agree with both of other MVP
friends. With custom profile, custom membership and custom authorization
providers that either you can write or find on the web, you can easily get
over these kind of problems.

If you insist about using your own stuff within your Application class with
a Singleton architecture, I would like to suggest you reading about "lock"
feature in C#.

All the best,
Coskun SUNALI
MVP ASP/ASP.NET
http://sunali.com

>I agree here. In addition, Singletons on the web are exceedingly difficult
>to create especially across a server farm - throw in web gardens and it
[quoted text clipped - 46 lines]
>>> Any help and insight from experienced web application designers would be
>>> much appreciated.
Registered User - 23 Dec 2007 14:01 GMT
>I am a developer with many years (approx 10years) development experience
>using C++ for DESKTOP applications. I am writing a web application using
[quoted text clipped - 12 lines]
>
>etc.

Are these things your Application class does or things the web
application will have to do to support the Application class?

>Because of the nature of the work that the Application class does, there
>should not be more than one instance of it at any given time - since
[quoted text clipped - 6 lines]
>authentication/authorisation etc at the same time - so maybe a Singleton
>pattern would not be appropriate for web applications.

How does this work with the desktop application? It would seem that if
user A is running one instance of the app on  box A and user B is also
running an instance on box B, concurrency issues might exist. With a
web application is both instances will run on box C. The
functionality's container isn't radically different in this respect.

>Even if I used a Singleton pattern - is the single instance restricted
>to a particular users session - or does it apply server wide - i.e.
>accross all sessions?
>
>Any help and insight from experienced web application designers would be
>much appreciated.
Re-examine the desired core functionality and determine how/if it can
be used by multiple users at once. Any possible concurrency should be
handled within the application and not be limiting the application to
a single instance.

regards
A.G.
Alvin Bruney [MVP] - 31 Dec 2007 02:20 GMT
> How does this work with the desktop application? It would seem that if
> user A is running one instance of the app on  box A and user B is also
> running an instance on box B, concurrency issues might exist.

Not usually. With a desktop app, concurrency is only an issue if the clients
hit a common back end source.

Signature

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99

>>I am a developer with many years (approx 10years) development experience
>>using C++ for DESKTOP applications. I am writing a web application using
[quoted text clipped - 46 lines]
> regards
> A.G.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.