I have publish my Web Application in IIS and I getting Error while running
Server Error in '/' Application.
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 */ }
}
}
IHttpModule? Anyway the name attribute must also contain the assembly name. - CodeCaster