- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we maintain session between Web Client and Web Server?
Following are the few options to maintain the session between the Web Client and the Web Server −
A webserver can assign a unique session ID as a cookie to each web client and for subsequent requests from the client they can be recognized using the received cookie.
This may not be an effective way as the browser at times does not support a cookie. It is not recommended to use this procedure to maintain the sessions.
Hidden Form Fields
A web server can send a hidden HTML form field along with a unique session ID as follows −
<input type = "hidden" name = "sessionid" value = "12345">
This entry means that, when the form is submitted, the specified name and value are automatically included in the GET or the POST data. Each time the web browser sends the request back, the session_id value can be used to keep the track of different web browsers.
This can be an effective way of keeping track of the session but clicking on a regular (<A HREF...>) hypertext link does not result in a form submission, so hidden form fields also cannot support general session tracking.
You can append some extra data at the end of each URL. This data identifies the session; the server can associate that session identifier with the data it has stored about that session.
For example, with http://tutorialspoint.com/file.htm;sessionid=12345, the session identifier is attached as sessionid = 12345 which can be accessed at the web server to identify the client.
URL rewriting is a better way to maintain sessions and works for the browsers when they don't support cookies. The drawback here is that you will have to generate every URL dynamically to assign a session ID though page is a simple static HTML page.
- As HTTP is a stateless then how to maintain the session between web browser and web server?
- Difference between Web Browser and Web Server.
- Difference between Web Server and Application Server
- Difference between Deep Web and Dark Web
- How to enable Web view session storage in android?
- How to setup jQuery on my web server?
- Monitors linux server performance remotely using web browser
- Explain the difference between Dark Web Vs Deep Web?
- Difference between Microservices and Web Services
- Difference Between Web page and Website
- How to Setup HAproxy Load Balance Server for Sharing Web Traffic
- How to Setup Virtual Hosts with Apache Web Server on Linux
- Using HTML5 Server-Sent Events in a web application
- Difference between selenium RC and Web Driver?