Log Off OWA from Code Behind

 After many tries and havey googling to find out the best way to log off OWA from asp.net page code behind while logging out from my main application, i found out that this can be achieved in one way ( in my position). Rise a small popup window and call OWA log out page!

All done with a small javascript. the script is below ;

 private void LogoffOwa()
    {
        string popupScript = "<script language='javascript'>" +
   "var mywindow=window.open('https://OWA_SERVER_Adress/owa/auth/logoff.aspx?Cmd=logoff', 'CustomPopUp', " +
   "'width=1, height=1, menubar=no, resizable=no');" +
   "setTimeout(\"mywindow.close();\",3000);" +
   "</script>";
        Response.Write(popupScript);
    }

in the script you have to set the time out of the window. Do not close the window directly or you will not log off. Just give it some time to open the log off page.

Hope this helps

No Comments