I am developing web application using ASP.Net MVC. In my application I am using some many ajax calls through out my application to Get/Post data for some functionality. For some functionality I am showing iframed popup. My issue is that when session is expired in my application I am redirecting user to login page but if user try to access functionality that opens in iframed popup instead of redirecting to login page my popup opens with login page inside it otherwise it's working properly. So what is best way to check session is expired or not and redirecting user to login page from inside of iframed popup. The code for opening iframed popup is as follow:
function ShowPopup(Url, DialogTitle, W, H) {
/* Setting for dialog box */
$("#dialog").dialog({
title: DialogTitle,
autoOpen: false,
modal: true,
resizable: false,
width: W,
height: H,
open: function (ev, ui) {
/* Setting URL to open in iframe */
$('#ContentIframe').attr('src', Url);
}
});
/* Opening dialog box */
$('#dialog').dialog('open');
}
Make as to check session
Before calling your code check this
It can be done using following logic...
Write following block of code in your Login Page
(window!=window.top) will return true if Login page is opened in IFra
Hope it helped