I have publish my Web Application in IIS and I getting Error while running
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 'SecurityHttpModule'.
My Web Config Like
<httpModules>
<add name="SecurityHttpModule type="SecurityHttpModule"/>
</httpModules>
My SecurityHttpModule Like
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public interface IHttpModule
{ }
namespace BankSuite
{
public class SecurityHttpModule : IHttpModule
{
public SecurityHttpModule() { }
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(Application_BeginRequest);
}
private void Application_BeginRequest(object source, EventArgs e)
{
HttpContext context = ((HttpApplication)source).Context;
string ipAddress = context.Request.UserHostAddress;
if (!IsValidIpAddress(ipAddress))
{
context.Response.StatusCode = 403; // (Forbidden)
}
}
private bool IsValidIpAddress(string ipAddress)
{
return (ipAddress == "127.0.0.1");
}
public void Dispose() { /* clean up */ }
}
}
It seems like you are missing a closing quote on the name
make sure it is not like that in reall config
Try specify using Fully qualified name
such as NamespaceQualifiedTypeName, AssemblyName
so something like BankSuite.SecurityHttpModule, AssemblyName
- where AssemblyName
correspond to your dll name
also if you are using iis 7+ with integrated mode, use
<configuration>
<system.webServer>
<modules>
<add name="SecurityHttpModule" type="BankSuite.SecurityHttpModule, AssemblyName"/>
</modules>
</system.webServer>
</configuration>
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.