Hi Cisco,
Thank you for your update.
I think using an HttpModule here is reasonable. Following is the official
MSDN documentation about ASP.NET Required ACLs:
#ASP.NET Required Access Control Lists (ACLs)
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
Another approach in my opinion would be using a timer to check the hardware
periodically, and sets an application variable when the check failed. You
check the application variable in Application's OnBeginRequest event, if it
failed, threw an exception.
Some example code:
void Application_Start(object sender, EventArgs e)
{
Timer t = new Timer(3000);
t.Enabled = true;
GC.KeepAlive(t);
t.Elapsed += new ElapsedEventHandler(t_Elapsed);
Application["timer"] = t;
}
void t_Elapsed(object sender, ElapsedEventArgs e)
{
if (checkHardwareFailed()) {
Application["failed"] = "1";
// you might then disable the timer since the application needs
restart anyway
}
}
void Application_OnBeginRequest(object sender, EventArgs e)
{
string status = Application["failed"] as string;
if (status == "1")
{
throw new Exception("Hardware check failed!");
}
}
This way you don't need to use an HttpModule and don't need to modify
web.config or machine.config.
Hope this helps. Please feel free to post here if anything is unclear.
Regards,
Walter Wang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.