Hi I'm a bit confused about this whole server side / client side thing. Are applets, embeded objects consider client side? If I have a form within my aspx page which connects to a database on the server side what is it considered? If I have some business logic written within a VB file when the client access the functions within that business logic (for example some kind of validation function) does the client browser actually downloads that VB file? Can someone suggest how to differentiate between client side and server side components within a asp.net based website?
Hi,
i can't understand your actual problem but i m just trying to solve your confusion bet. client side and server side.
Suppose u want to apply some business logic and for that u need some data from database side so 4 that u write your all calculation and your all business logic on databaase side to use some "stored procedure" or "triggers" it will give you fast access.
and Suppose u want to apply some business logic and for that u dont need some data from database side so 4 that u write your all calculation and your all business logic on "javascripts" so its totally on "client side scripting". and page doesnt need to go back on server.
Hi rjjctm,
If you go tohttp://www.webopedia.com type server-side
"Occurring on theserver side of aclient-server system. For example, on theWorld Wide Web,CGI scripts are server-side applications because they run on theWeb server. In contrast,JavaScript scripts are client-side because they are executed by yourbrowser (theclient).Java applets can be either server-side orclient-side depending on which computer (theserver or the client) executes them. "
In your case:
If I have a form within my aspx page which connects to a database on the server side what is it considered?
( SERVER-SIDE )
If I have some business logic written within a VB file when the client access the functions within that business logic (for example some kind of validation function) does the client browser actually downloads that VB file
( SERVER-SIDE )
------------
Simple Scenario:
You have an object called [ACCOUNT]:
ACCOUNT have 2 property, ACC_NO and ACC_LIMIT.
Given rules ACC_NO is unique and ACC_LIMIT cannot be greater than 5000.
*** To validate above ( remember, always client-side get executed first ):
1) We validate ACC_LIMIT using client-side ( javascript )
<script language="javascript">
function ValidateAccountLimit(value)
if ( value > 500)
{
alert("Account limit cannot be greater than 5000");
return false;
}
</script>
2) Validate ACC_NO using server-side (c#)
private bool IsAccountNoExisted(string sAccNo){DataSet ds = SqlHelper.ExecuteDataSet("Select * from Account where ACC_NO='" + sAccNo +"'");if ( ds !=null )if ( ds.table[0].Rows.count > 0 )return true;// return true where record foundreturn false;// return false record not existed}
Hope this is clear enough.
SERVER SIDE VS CLIENT SIDE
Simply put there are two distinct operations involved in displaying anyweb page to the visitor the first being server side operations and thesecond client side operations.
Server Side Operations
Server side operations are concernedwith the sending of the web page data from the server to the web pagevisitors browser. In the case of Static Web Pages the data is simplyserved immediately upon request for the data from the visitors browser.If the requested page is a Dynamic Web Page then any pre processing ofthe page is carried out and the output is then served to the visitor.
PHP and ASP(vbscript) are server side scripting languages thatare used to pre process pages and output HTML before the page is sentto the visitor. HTML is the language that the browser understands thattells it how to display the page.
Client Side Operations
Client side operations are performed on the visitors computer by the users Internet browser to display the web page as the data is received from the server.
HTML is interpreted as it is read by the browser resulting in thedisplay of the web page within the browser. Once the page has loadedHTML cannot be reprocessed without refreshing the page.
The visitors experience on the web page can however be enhanced bymeans of a client side scripting language, typically Javascript used inconjunction with dynamic html and cascading style sheets, which enableinteractive menu systems, hi-lighting effects, image effects, datamanipulation and many other actions to be performed on the page withoutreloading or refreshing the page.
The relationship between server side and client side operations can be illustrated by the following example.
Suppose you wanted to display the current time on a web page. You havea number of options, you have the choice of displaying the current timeaccording to the web server or the current time according to thevisitors computer.
If you want to use the server time then server side pre processing willbe required to determine the current time on the server and write it tothe output in html format before the page is sent to the visitor.
To use the visitors local time, the current time on thevisitors computer is used to determine the time and display it on thepage. Since Javascript is running on the client side the time can beupdated and displayed in real time on the page without having to reloador refresh the page.
This is not possible with server side scripting as the page needs to bere processed on the server to determine and output the new time and resend to the visitor in order for the new time to be displayed.
The server time could of course be written to the page as a Javascript variable which Javascript could then use to set a local page time variable which could then be used to keep time. However one must bear in mind that time would elapse between the server creating and writing output for the Javascript time variable and Javascript actually reading in the variable upon page loading. Also one must remember that the updating of the clock would still be performed as a client side Javascript operation.
Whether you choose to display the local time on the server sideor client side or any of the standard times such as GMT, PST, EST isirrelevant as both server and client operations use the respectivelocal time and the time zone where the server or client is located todetermine the time in the aforementioned standard times.
Although primarily a client side scripting language, Javascript does offer some server side functionality however server side scripting languages such as PHP and ASP are generally far better suited to performing server side operations.
hope this helps./.
Thanks all for the help I think I have a better understanding now, Both kaushalparik27 and d4dennis examples helped me realized with some operations you can implemented both on the server side or the client side (ValidateAccountLimit can be done both in a javascript on the client side or a c# or vb based file on the server side but with the later there is the extra hassle of transferring data back and forth). But some operations such as validating account existence have to be done on the server side. I guess you would want as much things executed on client side as possible to reduce load on the server side.
So I guess to put it simply to determine whether something is server side or clients side code we just have to see where it's executed. Typing the above sentence out suddenly make it so obvious.
0 comments:
Post a Comment