Hello Techers,
I am new to the DNN frame work (How many times has that line been used?) and trying to port my existing web application to DNN.
Currently having several issues.
on my old site I had a custom Http module for doing some webscraping and initialsing some custom tables with some feeds at regular intervals using a TimerCall back.
This works fine in my old web site and also compiles with DotNetNuke solution .
namespace DotNetNuke.HttpModules.N9JA
{
public class N9JAInitModule : IHttpModule
{
public N9JAInitModule() { }
static bool firstTime = true;
// SessionStateModule session;
void System.Web.IHttpModule.Init(System.Web.HttpApplication context)
{
Debug.WriteLine("Init App with context" + DateTime.Now.ToString());
if (_webScraperTimer == null)
{
Random rand = new Random();
_uniqueId = rand.Next();
int syncTime = (rand.Next(10) + 5) * 100000;
_webScraperTimer = new System.Threading.Timer(new TimerCallback(NJWebScraperCallback), context.Context.Cache, 0, 360000);
}
}
.....
}
#region "Web Scraper Timer"
protected static System.Threading.Timer _webScraperTimer = null;
protected static object _webScraperSemaphore = new object();
protected int _webScraperUniqueId = 0;
protected int _uniqueId = 0;
private void NJWebScraperCallback(object sender)
{
// AutoResetEvent autoEvent = new AutoResetEvent(false);
// autoEvent.WaitOne(10000, false);
lock (_webScraperSemaphore)
{
System.Diagnostics.Debug.WriteLine("NJWebSracper Timer Invoked");
NJWebScraperThread.WebScraperThreaded(_webScraperUniqueId);
}
}
#endregion
I have added the resulting dll to the bin folder of my web site and also added the following to the web.config
<add name="N9JAInitModule" type="DotNetNuke.HttpModules.N9JA.N9JAInitModule, DotNetNuke.HttpModules"/>
However when I start my web application I get the following error:
Line 122: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Line 123: <add name="Analytics" type="DotNetNuke.HttpModules.Analytics.AnalyticsModule, DotNetNuke.HttpModules" />
Line 124: <add name="N9JAInitModule" type="DotNetNuke.HttpModules.N9JA.N9JAInitModule, DotNetNuke.HttpModules"/> Line 125: </httpModules>
Line 126: <httpHandlers>
Can anyone help or is this wrong approach to implementing a custom HttpModule?
Thanks & Regards,
Abbey
[Moderator edit: corrected a spelling issue in title for item being searched]