Asp.net

ASP.NET

Basic Client side server calls A quick note about client side versus server side programming in asp.net. This is a very important concept that translates to other languages as well that uses HTTP to get or post data. The Get and Post are just two basic commands in HTTP protocol. Get uses query strings, while post uses the body or envelop of the message. You can study up on HTTP by performing a search on HTTP and Get and Post in a reputable search engine.

Understanding Basic TCP/IP Client Server Technology Ok, so now that we are past that, and you have researched HTTP protocols and you understand the basic structure of a Get and Post among other commands, it is good to understand how a client and server work. This applies to post backs, as well as AJAX server requests, and how AJAX receives server responses:

  A TCP/IP thread consists of an IP address that you connect to, a port number(usually 80) to connect to, and an agreed upon protocol. For asp.net it generally uses HTTP as the basic agreed upon protocol. In programming you can use sockets programming to perform all of the functions of a basic server, run it on a thread, use your firewall to open up the port/ports (usually just port 80) and open up the ports on your router or switch such as port 80 for the computers ip address. This can be dangerous if you don't understand exactly what it is doing so ask your administrator for any possible security risks as the system admin or security expert on your site should know the risks. Anyway, you now have an open port from which you can connect to from another computer either on the network, or even from the internet. If you have opened up the port and ip address to the internet you should be able to access your server from a client anywhere on the network. Obviously you need the right type of service to have enough bandwidth to be useful to other clients. If the connection has low bandwidth and slow response times you will lose potential customers because they most likely will not be interested in waiting on your slow connection. You should be aware that most home connections have very low bandwidth to upload content to the internet, so it limits the bandwidth of a server on a home network.   In modern systems the TCP IP connection creates a thread to search for clients trying to connect to it. The connection can be blocking(accept only 1 connection at a time) or non-blocking (accept multiple connections, and create a new thread for each instance.) In a non-blocking connection, it can even perform switch ports on the server and even switch the IP address to perform load balancing. This is for more advanced users and is also information that you will get from real world scenarios or at the masters degree level of Information System degrees as well as advanced network certifications. Non-blocking method is less secure and has more vulnerabilities, but also offers much more users to connect at a time. When you have a non-blocking connection you need to be aware of your security vulnerabilities and lock them down if feasible.   Basic TCP/IP client request, and server response ... back and forth communications. A server performs the jobs of waiting for a client to connect and give it some command. There are lists of commands in HTTP that a client can give a server. The main thing to understand is that a server waits for the client to connect, it can wait a minute, or a thousand years until a client connects to it, if a server is more popular, it can get a connection from a client several times a second, if it is not popular, it may never be connected to. So if it's a popular Server, such as one you have created, or hope to create, it will wait for a client to connect to it. Today's modern servers are usually attached to a thread, and as the client connects, it creates an open connection, and the server then open up a new thread to wait for another client to connect. If it uses connection pools, it may have 10 or 20 threads waiting at any given time instead of just one thread waiting for 10 or 20 clients to connect at any one time. Each established connection in a multi threaded environment causes a new server thread to wait for another client. As the connection to a clients request is open, it performs one function, process only one command such as a get or a post during that thread. It sends it's response over the same connection, and then immediately closes the connection. This is a tidy and simple connection. This in turn usually destroys that thread, and removes any "STATE" associated with that connection. You can research for yourself the HTTP GET and the Server's HTTP response.  

About GET and POSTS A client's GET command is usually much simpler that a client's POST command. You can send a few parameters with a GET, you can send an unlimited number of parameters and other types of information with different mime types using a post. You don't even need a browser to send this information, you can use any type of socket connection as long as it meets the correct response time needed to send the message, and it is in the correct format.

Starting ASP.NET 2.0 ASP.NET 2.0 processes Gets and Posts from the client just like a regular HTTP Server. It then sends responses to the client. The major difference is that it contains server side controls that can be connected to a back end program such as visual basic or c#. This back end program can perform additional steps on the server controls before the server spits it out into an html response to the server. In addition, this html can be created specifically for specific types of browsers. The asp.net 2.0 server controls must have an ID and a runat="server". This provides a means to make changes to the server depending on how a command is processed from the client before it spits out the HTML response to the client. Understanding the steps that take place between a Clients command request, and the server's response is essential to any server side programming, and is especially important in asp.net 2.0. To learn the steps that an asp.net server must take before spitting out an html response, look up "ASP.NET Page Life Cycle" on a reputable search engine. This is how the html is rendered before the html is spit out in response to the client's get or post command. There are other types of http client request commands, but the "get" and "post" commands are the primary commands used by the client.

Page events vs Control Events during the Page Life Cycle It is important to understand the order, and what the first event that is fired, and the last event that is fired. You should be aware that not only does the page have events that are fired, but the controls also have events that are fired while rendering the page into html. So, you think you understand page life cycle? Now would be a great time to verify what you know. To verify the page life cycle of both the page and the controls you need to enable the trace for asp.net. Research this now: "Enabling Trace in ASP.NET". NOTE: Add this near the top of the page: