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

Validation in a three tier architecture

Good evening,

I create a three tier ASP.NET web application. How can I validate the
form input data in the Business Logic Layer? Can anyone give me an
example?

Feb 15 '06 #1
3 1709
Hello Student,

Why not to use ASP.net validators for this?

S> Good evening,
S> I create a three tier ASP.NET web application. How can I validate the
S> form input data in the Business Logic Layer? Can anyone give me an
S> example?
S>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 15 '06 #2
Student wrote:
Good evening,

I create a three tier ASP.NET web application. How can I validate the
form input data in the Business Logic Layer? Can anyone give me an
example?


Well, what I do, is in the submit method, you could take the values of
your form, and run them through your validation methods. If the
validation returns false, then don't do a Server.Transfer to the next
page, put the user back on form where the problem is
private void bookingSubmit_Click(object sender, System.EventArgs e)

{

if(this.validateForm())
{
//data is ok; proceed
Server.Transfer("nextpage.aspx");
}
}

//this method could be in the "business logic layer"
bool validateForm()
{
if(this.FirstName.Length==0)
return false;

//... and so on
}


Feb 15 '06 #3
Validation is one area where you cannot do all validation in one place.
Sometimes you need to validate on the page, sometimes in the server
code, in the business object and again in the data services area. I try
and at least have all validation done in the business object so there
is one place where the validation rules exist but you will have to
duplicate validation in other areas too. For example you may check that
you got a particular value. You may wish to check this on the page so
the user gets immediate response but by the time it hits the business
object you want to validate it again because you may be unsure where
the data came from (and hence has it been validated) and also people
can post to your website without going through your pages so if it
assumes something has been already checked you may open yourself up for
attacks.

Feb 15 '06 #4

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

Similar topics

77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
25
by: David Noble | last post by:
We've been developing a web site using 3-tier architecture for 18 months now. There is a common layer that defines the classes - using XML schemas. The data layer acts as a wrapper to 3 databases...
3
by: RAJESH | last post by:
I am working with c# and asp.net in developing web applications, iam using ..netframework 1.1 ,i want to know what is the need of 3-tier or 4-tier architecture in our application development.what...
10
by: Adam White | last post by:
The company I work for used to create web applications using an ASP user interface, VB6 COM+ middle-tier with a SQL2K back-end. They have recently moved on to .NET with ASP.NET user interfaces and...
8
by: Charles Law | last post by:
This is a sort of pattern question, but relating to how components are coupled in a three-tier system. I have a presentation layer, business layer and data access layer, the first is the EXE,...
1
by: crprajan3529 | last post by:
The following is the complete code snippet written in c# for a windows application which connects to a sql server database and it also contains code for loading the records and navigation of records....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.