DNN 9.7.2
I am getting an exception usually at night on a new project of mine. It is deployed to a hosting provider and visable to everyone.
My exception is : Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
In my web.config there is: <pages validateRequest="false" enableSessionState="true" enableViewStateMac="true" enableEventValidation="true" viewStateEncryptionMode="Always">
The exception is happening while getting Session.SessionID within one of my modules. This module is present on all pages in the application.
The application runs fine when I am here at work - but a night when I am not here this happens. I also never got this error while running application on my local dev machine. So I suspect a bot. Or possibly, hosting company shutting down services for some reason?
Is there any way to prevent this from happening? Like if(Session.Isavailable) or something I can add to my function in programmatically?
if(Session.Isavailable)
Thank you for reply,
How in the world do you block an entire country - that is a good idea.
I just have a dedicated server running windows server 2019 with plesk - I know you can block per ip, but that would be allot of ips. Especially Russia and China - which I would just love to block.
If you switch to using a WAF, then it's as simple as setting a firewall rule. CloudFlare supports this scenario in its free plan (see the example screenshot below). 😊
When you're ready, you can add it to CloudFlare easily by copying and pasting the shortcode for it below.
(ip.geoip.country in {"AU" "AT" "BE" "BZ" "CA" "DK" "FI" "FR" "DE" "GL" "GU" "GR" "HU" "IS" "IE" "IM" "IT" "JP" "KR" "MX" "NL" "NZ" "NO" "PR" "ES" "SE" "CH" "UA" "GB" "US"})
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.