Click here to Skip to main content
15,916,042 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In an asp.net project, if the javascript code that I use on the view side uses different users at the same time, is there any problem?


What I have tried:

I started working on a new project.
But I have doubts. I will write the code, but is it a problem if different users perform operations such as record creation and search filtering at the same time?
Posted
Updated 27-Aug-19 10:20am

Quote:
if the javascript code that I use on the view side uses different users at the same time, is there any problem?
On the same machine? Like as in fighting to execute the JavaScript code, then yes there would be problem.

Just kidding: No, the client-side code remains on the users' machines and multiple users executing the same code do not interfere with each other.
Quote:
but is it a problem if different users perform operations such as record creation and search filtering at the same time?
Each user will have their own session and their own connection with the server. So a JavaScript function call from User1 will not affect what User2 is doing and vice versa.

However, multiple executions of the code on the server-side will introduce some racing scenarios and you will need to take care of that part. Read here for more on this, Race condition - Wikipedia[^].

A racing condition is when 2 users simultaneously access a resource to modify it (all of them reading will not cause an issue), and that can be handled in different ways. But JavaScript code execution is different with everyone and will be just fine—unless you work in Node.js environment.
 
Share this answer
 
Since javascript is executed on the client side, and not on the server side, what is done in the script only concerns the specific client it runs on, and the script doesn't/cannot have any knowledge of what other clients are doing.

Database operations are initiated from the server side; and database engines do generally have some functionalities to handle concurrent accesses.

In short, your javascript should not, ever, try to access the database directly. The client talks to the server, the server handles requests from clients, issues commands to database, and serves results to clients.

Note that all what I describe here is very schematic; if you want to get serious about web development, you should take time to study general architecture of a client-server application.

Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900