473,320 Members | 1,865 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,320 software developers and data experts.

Web application design question

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.
Dec 23 '07 #1
5 1253
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.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Frank Moyles" <fg******@nospam.comwrote in message
news:L6*********************@bt.com...
>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.

Dec 23 '07 #2
On Sun, 23 Dec 2007 11:27:49 +0000, Frank Moyles <fg******@nospam.com>
wrote:
>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.
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
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.
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.
Dec 23 '07 #3
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.

--
--
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

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:eP**************@TK2MSFTNGP05.phx.gbl...
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.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Frank Moyles" <fg******@nospam.comwrote in message
news:L6*********************@bt.com...
>>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.

Dec 24 '07 #4
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

"vapor" <va******@hotmail.comwrote in message
news:38**********************************@microsof t.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
becomes an expensive approach.

--
--
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

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:eP**************@TK2MSFTNGP05.phx.gbl...
>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.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Frank Moyles" <fg******@nospam.comwrote in message
news:L6*********************@bt.com...
>>>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.

Dec 24 '07 #5
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.

--
--
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

"Registered User" <n4***@ix.netcom.comwrote in message
news:l2********************************@4ax.com...
On Sun, 23 Dec 2007 11:27:49 +0000, Frank Moyles <fg******@nospam.com>
wrote:
>>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.
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
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.
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.
Dec 31 '07 #6

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

Similar topics

4
by: MG | last post by:
A Newbie question perhaps, but here goes: Is it possible to seaprate the presentatieon layer, i.e., the html, from the application itself. For example, our developer has told us that we cannot...
43
by: Davey | last post by:
I am planning on developing an application which will involve skills that I have very little experience of - therefore I would appreciate comments on my initial design thoughts. Overview on...
4
by: Adam Clauss | last post by:
This may be more of a Visual Studio question than a C# question, but it came up within the context of a C# app, so here it is. In a Windows Form or a Web Form application, you can drag various...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
10
by: Saso Zagoranski | last post by:
hi, this is not actually a C# problem but since this is the only newsgroup I follow I decided to post my question here (please tell me where to post this next time if you think this post...
1
by: aparnasinha26 | last post by:
Hi All, I have to develop an application .The application has to update database.It does not have any user interface.It needs to run on Windows XP/2000 automatically at a particular time say 4...
2
by: Matthew Hood | last post by:
My company has expressed a desire to convert an existing MS Access application to a full VB.NET application. My experience is with VB6 so I want to ask a few questions and get some input on the...
4
by: Paciente8159 AKA Klayman | last post by:
Hi, I have a couple of doubts reggarding a plugin based application in C++? I want to build a c++ plugin based app. I have searched alot of things in the net but I still don't know how to...
6
by: goraya | last post by:
This is design level discussion about web applications. How I design application that support 1 million concurrent requests??
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.