Accessing CacheHelper.GetCurrentSiteSettings() from a HttpModule

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/1/2013 6:28:01 AM
Gravatar
Total Posts 19

Accessing CacheHelper.GetCurrentSiteSettings() from a HttpModule

Hi Joe

I have a HttpModule that contains a timer which polls a database to see if any emails need to be sent to certain users. I need to get the SiteUser object, for each user, to retrieve a custom property - but to get the site user I need the current site settings which are null when I try and use CacheHelper.GetCurrentSiteSettings().

Any suggestions much appreciated.

Thanks

Stewart.

 

2/1/2013 11:18:09 AM
Gravatar
Total Posts 18439

Re: Accessing CacheHelper.GetCurrentSiteSettings() from a HttpModule

Hi,

GetCurrentSiteSettings() only works in the context of a web request.

I "think" you might be able to use CacheHelper.GetSiteSettingsFromCache()

I will say that using an HttpModule to do what you are doing is not something I would do and it sounds pretty resource expensive polling the db and creating site user objects from there, it could potentially impact performance or cause weird bugs or side effects. HttpModules are meant to handle events related to http requests not really for running tasks.

Best,

Joe

2/4/2013 3:51:56 AM
Gravatar
Total Posts 19

Re: Accessing CacheHelper.GetCurrentSiteSettings() from a HttpModule

Hi Joe

Thanks for the reply.

In light of your comments I've reviewed how I create recurring tasks in an asp.net environment, and I've found this very enlightening article on the topic.

http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx

Stewart

You must sign in to post in the forums. This thread is closed to new posts.