I am hosting an Asp.Net website in IIS 6.0
We have to reset the session timeout in web.config
My client want me to reset it only if no session is running (no one is using the site).
We have not used Membership and SessionState is set to InProc
How I get to know if anybody using the site or any session is running.
I can't make change in source code or any other file except web.config in the hosted website.
Best Answer
I'm not great at PowerShell, so hopefully you can look up the proper syntax. But ...
One option is to run a Powershell script and check the count of the session like this:
UPDATE: Changed 'Sessions Total' to 'Sessions Active'
Save this on the desktop as "ChangeIIS.ps1".
Now Powershell doesn't like you just running scripts like .bat files. You have to grant access to the process or your user for security reasons. So do the following:
powershell
Set-ExecutionPolicy -scope process Bypass
sl <path to directory of .sp1 file>
.sl
[set-location] is likecd
in command prompt$ '.\ChangeIIS.ps1'
It will run now and reset the value.
Here is a link to my blog on how I created the PowerShell script in a more Step-by-step fashion