M
Mikael Syska
Hi,
Google gives alot of hits on httpmodules but I can't seem to find any
useful on my problem ...
I have a site where I'm using my own auth system ... ( guess it could be
better but its work, maybe I will make a new one later, or use the build
-in )
But to my problem ... I have a Admin area, but that users dont have
access to ... So I wanted to make a httpmodule that checked a Session
variable to see if the user had a high enough level to get access to the
admin area ... but I can't get it working:
I have tried many thing in the Web.Config file ...
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<httpModules>
<add type="Syska.Errors.Admin" name="Admin" />
</httpModules>
</system.web>
</configuration>
This file is placed in the "/admin" folder on the site ...
So all the normal request dont get parsed in this module ...
My Class:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace Syska.Errors
{
public class Admin : IHttpModule
{
public void Init(HttpApplication app)
{
app.BeginRequest += new EventHandler(app_BeginRequest);
app.Error += new EventHandler(app_Error);
}
void app_Error(object sender, EventArgs e)
{
throw new Exception("The method or operation is not
implemented.");
}
void app_BeginRequest(object sender, EventArgs e)
{
throw new Exception("The method or operation is not
implemented.");
}
public void Dispose() { }
}
}
And none of the above get executed ...
Am I doing somewrong here ?
best regards
Mikael Syska
Google gives alot of hits on httpmodules but I can't seem to find any
useful on my problem ...
I have a site where I'm using my own auth system ... ( guess it could be
better but its work, maybe I will make a new one later, or use the build
-in )
But to my problem ... I have a Admin area, but that users dont have
access to ... So I wanted to make a httpmodule that checked a Session
variable to see if the user had a high enough level to get access to the
admin area ... but I can't get it working:
I have tried many thing in the Web.Config file ...
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<httpModules>
<add type="Syska.Errors.Admin" name="Admin" />
</httpModules>
</system.web>
</configuration>
This file is placed in the "/admin" folder on the site ...
So all the normal request dont get parsed in this module ...
My Class:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace Syska.Errors
{
public class Admin : IHttpModule
{
public void Init(HttpApplication app)
{
app.BeginRequest += new EventHandler(app_BeginRequest);
app.Error += new EventHandler(app_Error);
}
void app_Error(object sender, EventArgs e)
{
throw new Exception("The method or operation is not
implemented.");
}
void app_BeginRequest(object sender, EventArgs e)
{
throw new Exception("The method or operation is not
implemented.");
}
public void Dispose() { }
}
}
And none of the above get executed ...
Am I doing somewrong here ?
best regards
Mikael Syska