2014-11-04 3 views
0

이전 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() 처리기에 중단 점을 설정할 수 있으며 해당 중단 점에 도달하지 않습니다.

한 번에 작동했습니다. 아무도 빠진 것을 볼 수 있습니까?

참고 : 차이가 있는지 모르겠지만 web.config 파일에도 <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />을 지정합니다.

답변

0

IIS 7.0 통합 모드에서 Web.config 구문이 변경되었습니다 (통합 모드의 의미).

내 질문에 구성 대신 다음과 같이 수행해야합니다.

<system.webServer> 
    <modules> 
    <add name="ThemeManager" type="SoftCircuits.MediCorp.ThemeManager"/> 
    </modules> 
</system.webServer> 

저를 위해 고쳐주었습니다.

http://msdn.microsoft.com/en-us/library/vstudio/ms227673(v=vs.100).aspx