Web Apps: Stateless & Unidentified Requests - Essay Sample

Paper Type:  Essay
Pages:  6
Wordcount:  1606 Words
Date:  2022-12-27

Introduction

Web applications are stateless. Thus, when a request by a user is received by the web server to display a given web page, the server obliges to the request by sending the corresponding HTML to the browser of the user. After this process, the communication between the server and the browser stops until the server receives another request. When the next request comes, the server cannot identify the user from which the request has been made or the page it had previously sent. After every request by the user, the server wipes the slate clean for the next request. Thus, to identify the user as well as the web pages it had sent before, the server employs various techniques which are used to store information that aids its memory. These techniques apply to both the client-based state management and the server-based state management. The client-based techniques include the ViewState, cookies, and query strings while the server-based techniques include the session state, the application state, and the database support.

Trust banner

Is your time best spent reading someone else’s essay? Get a 100% original essay FROM A CERTIFIED WRITER!

ViewState

The client-based state management techniques such as ViewState used in the web application management is aimed at helping the server remember the required information about given webpages. ViewState is built in within the WebForms pages, and it automatically retains the control over the multiple requests made by a given page. The ViewState web application state management technique is implemented through a hidden form field control called the _VIEWSTATE. Before a web page is submitted back to the server, the page first checks on the value of every control and writes the name of the control as well as their states into the _VIEWSTATE control.

Flipping off the ViewState Switching On and Off

The passing of the ViewState information often involves the processing on the server for every given page. However, the ViewState is not usually a priority for every page on a web application. For this reason, the developer can turn it off when it is not required. Turning off the view state will help to streamline the demands on the server resources and optimize the speed of the application. The ViewState functionality can be enabled or disabled at the page level or using the individual controls. Disabling the ViewState at the page level involves setting the enableViewState attribute to False in the directives at the top of the page.

Hitching a Ride on ViewState

There are times when the web application would need to send other information to the server with the page request within a given round trip. The process is often achieved through the use of ViewState() function which accepts the name of the values to be stored as well as the parameters and the values to be stored. It is important to note that there is no limit to the use of ViewState() function. Thus it can be used as many times as the developer pleases.

Advantages of Using ViewState

ViewState() function is one of the most commonly used web application state management methods because it is easy to implement, it retains the page and the control state automatically, and it does not also make use of the server resources since the page information can be found within the page.

Disadvantages of Using the ViewState

Storing the ViewState information of the page makes it easy for potential page bloat for heavily populated pages as well as those containing DataGrids. Thus, a problem with the ViewState always results in slow page loading speeds and delays in page postings. ViewState also imposes a security risk since the page information is within the page; thus can be easily manipulated.

Query Strings

Query strings are a long string of characters embedded in the URL of a given page. The Query strings help the web server to keep track of the returning web pages. They are simple and popular techniques used in passing data from a given page to the next. In query strings, data is appended to the URL of the page that pulls the data off the URL line and makes use of it. An example of a query string is as below

http://www.example.com?username=johndoe

The values within a query string can also be separated as below:

http://www.example.com?username=johndoe&city=winterfell

The query string can be implemented in various ways, through code. It can be coded within the HTML hyperlink as follows

<a href=www.example.com?city=Winterfell">Select City</a>

The query string can also be implemented using the Response.Redirect method as below.

Response.Redirect("www.example.com?username=johndoe")

The query string can also be constructed using the web form control values as below.

Response.Redirect(www.example.com?username=& txtName.Text & "&city=" & txtCity.Text)

However, many browsers do not support blanks in query strings. Thus, issues often arise when using web form controls. To solve this, the server.URLEncode is often used to encode the characters within the URL.

Response.Redirect(www.example.com?username=

& Server.URLEncode(txtName.Text) & "&city="

& Server.URLEncode(txtCity.Text"")

Thus, using the above lines of code, entering John Doe as username and Winterfell as the city would produce a URL like this

http://www.example.com?username=John%20Doe&city=Winterfell

Retrieving Query String Values

Grabbing the query string values from a given URL is simple. Local variables are declared which are used to store UserName and City query strings.

Dim UserName As String

Dim City As String

UserName = Request.QueryString("UserName")

City = Request.QueryString("City")

Advantages of Using a Query String

Query strings are preferred by developers because they are easy to implement, there is universal support for passing the values in the query string, and the query strings embedded within the HTTP request for a given URL do not utilize the resources of the server.

Disadvantages of Using the Query String

The query strings are often insecure because they are directly visible to the users on the browsers address line. Various browsers also impose the 255 URL character which may often limit their flexibility.

Cookies

Cookies refer to small pieces of information that are stored on the client computer. The cookies are limited to storing only the character data which are limited to 4K in size. There are two types of cookies used. These include the session cookies and persistent cookies.

Session Cookies

The session cookies are often stored in the computer's memory during the browser session. When the browser is closed, the session cookies are lost. The session cookies are often created by calling the Add method of the cookies collection on the Response object. The Cookies collection contains the individual cookie objects of the HttpCookie which are used during the sessions.

Persistent Cookies

The persistent cookies work in the same way with the session cookies. However, the persistent cookies have an expiry date which indicates to the browser that it should write the cookie to the hard drive of the client. The cookies often last for a couple of days or even years. However, because the client can delete the cookies, it is not always a guarantee that the cookies will be present the next time a user visits the site.

Technologies That Have Enabled Offline Usability of Spa-Applications

Single Page Applications are more popular today. Some of the most used and high ranking pages according to the Alexa ranks are single page applications. The most popular single page applications include Facebook, YouTube, Twitter, GitHub and various services by Google. The single page applications are web applications that interact with the user by dynamically rewriting the current page rather than loading other pages from the server. The single page application approach avoids the interruptions with the user experience between the pages making the web application behave like a desktop application. In single page application technology, the pages does not reload at any point in the process and the controls does not also transfer to another page. The technology users the location hash or the HTML 5 history API to provide the perception as well as the navigability of the separate logical pages of the application. The single page applications usability offline has been enabled by the use of various technologies. Some of these technologies include the JavaScript Frameworks, Ajax, and Websockets. The JavaScripts frameworks that have been mostly used for the SPA applications include the React Native, Vue.js, Ember.js, Angular.js, Meteor.js, and ExtJS.

AJAX, on the other hand, is one of the most prominent techniques that have been implemented in the SPA applications. AJAX combines JavaScript and HTML which uses the browsers built-in XMLHttpRequest object in requesting data and the JavaScript and HTML DOM to display or use the data. AJAX behaviors in different browsers are normalized using popular libraries such as the jQuery. Web sockets is also another popular technology used by the Single Page Applications offline. Despite being a real-time technology that provides the bidirectional client-server communication, most of the offline applications are cached thus operates from the cache. Therefore, the application will still need to communicate with the local servers. In this case, the web sockets will be vital in providing the socket connection between the application and the local server. The sockets enable the applications to use multiplex data on the same connection making it easier for the AJAX libraries to operate using the same socket connection in the data transfer process.

Server Sent Events.

The caching of the single page application creates a local server which enables data transfer and response as per the users' requests. Thus, the use of server-sent technology

Cite this page

Web Apps: Stateless & Unidentified Requests - Essay Sample. (2022, Dec 27). Retrieved from https://midtermguru.com/essays/web-apps-stateless-unidentified-requests-essay-sample

logo_disclaimer
Free essays can be submitted by anyone,

so we do not vouch for their quality

Want a quality guarantee?
Order from one of our vetted writers instead

If you are the original author of this essay and no longer wish to have it published on the midtermguru.com website, please click below to request its removal:

didn't find image

Liked this essay sample but need an original one?

Hire a professional with VAST experience!

24/7 online support

NO plagiarism