MaxCoder88
MaxCoder88

Reputation: 2428

HttpModules Configuration error

1- I have a class structure as shown below.

namespace ViewStateSeoHelper
{
class ViewStateSeoModule : IHttpModule
{
    public void Init(HttpApplication context)
    {
        context.BeginRequest += new EventHandler(context_BeginRequest);
    }
    void context_BeginRequest(object sender, EventArgs e)
    {
        HttpApplication application = sender as HttpApplication;
        if (application.Context.Request.Url.AbsolutePath.Contains(".aspx"))
           application.Response.Filter = new HtmlFilterStream(application.Response.Filter);
    }
    public void Dispose()
    {
    }
   }
 } 

I'm using something like this to using in all those pages through upper code.

<httpModules>
  <add name="ViewStateSeoModule" type="ViewStateSeoModule" />
</httpModules> 

But,I got the configuration error.

Parser Error: Could not load type 'ViewStateSeoModule'. (C:\Users\xxx\Documents\Visual Studio 2010\WebSites\xxx\web.config line 78) Line 78:

Thanks in advance.

Upvotes: 1

Views: 735

Answers (2)

rtpHarry
rtpHarry

Reputation: 13125

You have wrapped your code in a namespace but not referred to it in the web.config:

<httpModules>
  <add name="ViewStateSeoModule" type="ViewStateSeoHelper.ViewStateSeoModule" />
</httpModules> 

Upvotes: 1

wsanville
wsanville

Reputation: 37516

The type attribute needs to include your namespace. Try:

<httpModules>
  <add name="ViewStateSeoModule" type="ViewStateSeoHelper.ViewStateSeoModule" />
</httpModules> 

Upvotes: 0

Related Questions