2012-07-20 2 views
1

사용자 정의 폼 인증을 사용하는 실버 라이트 애플리케이션이 있습니다. 브라우저 창이 닫히면 어떻게 로그 아웃 할 수 있습니까? Silverlight 응용 프로그램에서 앱 종료시 로그 아웃하는 방법은 무엇입니까?

나는이 같은 시도 :

public App() 
    { 
     Startup += ApplicationStartup; 
     Exit += Application_Exit; 

     UnhandledException += ApplicationUnhandledException; 
     var webContext = new WebContext {Authentication = new FormsAuthentication()}; 
     ApplicationLifetimeObjects.Add(webContext); 
     InitializeComponent(); 
    } 

    private void ApplicationStartup(object sender, StartupEventArgs e) 
    { 
     Resources.Add("WebContext", WebContext.Current); 
     RootVisual = new MainPage(); 
    } 

    private void Application_Exit(object sender, EventArgs e) 
    { 
     WebContext.Current.Authentication.Logout(false); 
    } 

을하지만이 작동하지 않았다. Ewery 시간 브라우저를 닫을 때 예외가 발생합니다. AsyncCallback에서 예외없이 예외가 발생했습니다.

이 문제는 어떻게 처리합니까?

답변

0

onbeforeunload가있는 페이지에서 ajax 호출을 호출 할 수 있지만 닫는 동안 실버 라이트로 logoff를 호출하는 아이디어는 잊어 버리십시오.

관련 문제