Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom HttpModuleCustom HttpModule
Previous
 
Next
New Post
11/2/2009 2:42 AM
 

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]

 
New Post
11/2/2009 12:07 PM
 

What is the error message.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
11/2/2009 1:23 PM
 

Mitch,

Doh!! Here is the error message:

 

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load type 'DotNetNuke.HttpModules.N9JA.N9JAInitModule' from assembly 'DotNetNuke.HttpModules'. (G:\WebProjects\DotNetNukeWebsite\web.config line 124)

Source 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?"

I have done some further investigation and I am starting to think I need to put muy code i the Global.asax.cs but I am worried if I remove the existing Global.asasx.vb code it might lead to problems.

 

 
New Post
11/3/2009 6:55 AM
 

 

I have found out that I can implement the periodic webscraping using the DNN Scheduling service so eliminating the need to have a custom HttpModule.

Although I will still like to know how to implement a custom HttpModule in DNN.

Regards,

Abbey

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom HttpModuleCustom HttpModule


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out