Hi sir,
Tell me the steps to limit the maximum no. of request to my website in asp.net c#. Suppose if i set 100 person can access my website at the same time, if new user visit
my website it has to show "the server is temporarily busy please try again after a moment". Kindly give me the solution for this problem.
[Hint : I need to set only 100 online users to enter the website , if the 101th user enter the website it has to show error like "Server is busy". I need to avoid network
traffic for my website request]
Loading
Abhishek JainPosted Sep 7, 2013, 4:18 AM
First of all create Page saying "Server is too busy" or any other mesage of your choice you want to display:
Now implemet the following functionality in your Gloabl.asax file
Application["AllowedUsers"] = 100;
// Locking here is done to keep the things Synchornized
if (Convert.ToInt32(Application["ActiveUsers"]) <= Convert.ToInt32(Application["AllowedUsers"]))
{
}
else
{
Although this will also become part of your Application because first it is coming to your application and then getting redirect but cannot access your application, so anyway you can keep the traffic low by showing only this message page
}
Regards
AJ