Asp.net HttpModules配置错误
1-我有一个如下所示的类结构Asp.net HttpModules配置错误,asp.net,Asp.net,1-我有一个如下所示的类结构 namespace ViewStateSeoHelper { class ViewStateSeoModule : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); } void context_BeginRequest(obj
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()
{
}
}
}
我在上面的代码中使用了类似的东西
<httpModules>
<add name="ViewStateSeoModule" type="ViewStateSeoModule" />
</httpModules>
但是,我得到了配置错误
分析程序错误:无法加载类型“ViewStateSeoModule”。
(C:\Users\xxx\Documents\Visual Studio 2010\WebSites\xxx\web.config
第78行)第78行:
提前感谢。类型属性需要包括您的名称空间。尝试:
<httpModules>
<add name="ViewStateSeoModule" type="ViewStateSeoHelper.ViewStateSeoModule" />
</httpModules>
<httpModules>
<add name="ViewStateSeoModule" type="ViewStateSeoHelper.ViewStateSeoModule" />
</httpModules>
类型属性需要包括您的名称空间。尝试:
<httpModules>
<add name="ViewStateSeoModule" type="ViewStateSeoHelper.ViewStateSeoModule" />
</httpModules>
<httpModules>
<add name="ViewStateSeoModule" type="ViewStateSeoHelper.ViewStateSeoModule" />
</httpModules>
您已将代码包装在命名空间中,但未在web.config中引用它:
您已将代码包装在命名空间中,但未在web.config中引用它: