< system.web >
< authorization >
< allow roles = " User " />
< deny users = " * " />
</ authorization >
</ system.web >
In which section I write code and what I write to configure that only 10 users access the asp.net website
< system.web >
< authorization >
< allow roles = " User " />
< deny users = " * " />
</ authorization >
</ system.web >
In which section I write code and what I write to configure that only 10 users access the asp.net website
There's no built-in ASP.NET feature for that; you will have to write your own code.
A good starting point will be to count the number of current users in Session_Start
and Session_End
, but note that you cannot reliably detect the fact that a user closed his browser without "logging out".
EDIT: If you use the ASP.NET Membership provider, Membership.GetNumberOfUsersOnline can give you an estimate of how many users are currently using your application. It reports "the number of users for the current [application] where the last-activity date is greater than the current time less [some configurable time window]."
you can set maxconnection in in machine config
Do you want to limit number of users or number of sessions both. ASP.NET membership provider is good option for restricting number of users.
You can limit maximum number of session allowed in web.config.
<system.webServer>
<asp>
<session max =""/>
</asp>
</system.webServer>
Hhere is a link that describes session configuration in IIS too.