What is the difference between client-side and server-side code in web development?

15

I'm studying ASP.NET through a book called Professional: ASP.NET 4.5 in C # and VB and at various times the author talks about client-side code and server-side , I would like to know the difference.

    
asked by anonymous 18.12.2013 / 20:22

4 answers

24

Server-side refers to the server side (your application server, eg IIS ) . Client-side refers to the client side (eg a web-browser).

The interaction works as follows: Server ← → Client ← → User

    The server provides the client with an output : it serves the desired page or files.
  • The server interprets the client : client sends information (form) to the server and uploads.
  • The client provides the user with an output: the rendered page that he got from the server (html).
  • The client interprets the user : user: the user enters different data on the client (and eventually sends them to the server) .

Example:

  • User : The user enters link in your web browser.
  • Client → Server : Then the client performs the page request to the google.com server.
  • Server → Client : The server receives the request, gets the page and sends it to the client.
  • Client → User : The client renders the page (HTML) received by the server and displays it to the user.
  • User → Client : The user enters a search in the search field of the page and clicks "Search".
  • Client → Server : The client sends the request with the search term entered by the user.
  • Server → Client : The server mounts the page with the search results and sends it to the client.
  • Client → User : The client, when receiving the page with the search results from the server, renders the new page and displays it to the user.
  • And so on ...

        
    18.12.2013 / 20:45
    12

    The difference is simply where the code will run: on the server where ASP.NET is installed ( server-side ) or on the browser from which the system will be accessed -side ).

    Although it is possible to develop an application / site exclusively using HTML and CSS on the client side (generating pages dynamically on the server, using only links and / or forms for data entry), many It is sometimes desirable for certain code to be executed on the user's browser, for example for validation purposes or usability improvement. In this case, the relevant snippet must be written in - or converted to - JavaScript, which is the only language universally accepted by browsers. Other forms of client code could be plugins like Flash or Java.

    Remember that the user agent does not necessarily have to be a browser - any application that implements the client side of the HTTP protocol can interact with the server application (without necessarily supporting JavaScript).

        
    18.12.2013 / 20:24
    2

    Client-side is the one that runs on the client side (eg Javascript), ie in the user's browser, Server-side runs on the server (eg PHP, JAVA, .NET ...)

        
    18.12.2013 / 20:24
    2

    Client-side = runs client-side, eg Javascript.

    Server-side = runs on the server, eg PHP, C #, etc.

        
    18.12.2013 / 20:24