Я обновляю старое приложение WebForms. Тем не менее, он не поднимает пользовательские темы.Настройки HttpModules игнорируются?
Мой файл web.config содержит следующее:
<system.web>
<httpModules>
<add name="ThemeManager" type="SoftCircuits.MediCorp.ThemeManager"/>
</httpModules>
</system.web>
А вот часть определения класса:
public class ThemeManager : IHttpModule
{
const string _defaultTheme = "BlueSky";
public ThemeManager()
{
}
public void Init(HttpApplication app)
{
app.PreRequestHandlerExecute += new EventHandler(Context_PreRequestHandlerExecute);
}
void Context_PreRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.CurrentHandler is Page && HttpContext.Current.Session != null)
{
Page page = (Page)HttpContext.Current.CurrentHandler;
// Note: To override the theme set here, set Theme = null in page's PreInit event
if (page != null && !HttpContext.Current.Request.FilePath.Contains("Help/"))
{
...
Но оказывается, что класс никогда не инстанцирован. Я могу установить точки останова в конструкторе, обработчик Init()
или обработчик PreRequestHandlerExecute()
, и ни одна из этих точек останова не попадает.
Это сработало за один раз. Может ли кто-нибудь увидеть, чего не хватает?
Примечание: я не знаю, имеет ли значение какое-либо значение, но я также указываю <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
в своем файле web.config.