2011-04-21 2 views
1

asp.net 응용 프로그램에서 우리는 몇 가지 가상 디렉터리가 있습니다. IIS7에서는이를 "응용 프로그램"이라고하며 모두 고전 파이프 라인 모드에서 실행되는 동일한 응용 프로그램 풀을 사용합니다. IIS7 가상 디렉터리간에 리디렉션

  • www.webapp.com/example2
  • www.webapp.com/example1

    그들은 동일한 물리적 디렉토리에 모든 점, C 말 : \ 웹 애플리케이션을. 유일한 차이점은 C : \ webapp \ styles \ (예 : C : \ webapp \ styles \ example1 \ base.css 등)에있는 다른 CSS 폴더를 가리키는 기본 가상 디렉터리가 있다는 것입니다.

    우리는 폼 인증과 기본 제공 멤버 자격 공급자를 사용합니다. 우리가 가진 문제는 다음과 같습니다.

    사용자가 www.webapp.com/example1/page.aspx를 탐색하고 www.webapp.com/example2/otherpage.aspx로 리디렉션되는 링크를 클릭하면 사용자는 대신 www.webapp.com/example2/login.aspx로 리디렉션되었습니다. 마치 세션이 만료 된 것처럼 보입니다.

    우리는 어디에서 해결책을 찾을 지 정말로 모르지만, 모든 포인터를 매우 높이 평가합니다! 미리 감사드립니다. 반사를 통해 (이 경우 applicationName에)에 고정 된 값으로 AppDomainAppId

    세트 :

    Globals.asax을 스테인

    답변

    1

    우리는 솔루션 그래서 내가 SO 지역 사회와 공유라고 생각했습니다. cs :

    protected void Application_Start(object sender, EventArgs e) 
        { 
         // make sure all set the same AppDomainAppId 
         FieldInfo runtimeInfo = typeof(HttpRuntime).GetField("_theRuntime", BindingFlags.Static | BindingFlags.NonPublic); 
         if (runtimeInfo == null) return; 
         HttpRuntime theRuntime = (HttpRuntime)runtimeInfo.GetValue(null); 
         if (theRuntime == null) return; 
         FieldInfo appNameInfo = typeof(HttpRuntime).GetField("_appDomainAppId", BindingFlags.Instance | BindingFlags.NonPublic); 
         if (appNameInfo == null) return; 
         var appName = (String)appNameInfo.GetValue(theRuntime); 
         if (appName != "applicationName") appNameInfo.SetValue(theRuntime, "applicationName"); 
        } 
    
    관련 문제