我正在使用示例mvc 2应用程序。因为我在web.config中处理了会话超时,所以下面的代码就是这个。
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" cookieless="UseCookies" name="FormAuthentication" timeout="1"/>
</authentication>
当我将屏幕保持在闲置状态时,这是代码对屏幕工作正常....
但我的问题是在一个特定的屏幕上,如果会话登录页面被重定向,则在一个面板中有八个选项卡,在空闲阶段之后,如果我单击选项卡中的链接按钮,则重定向选项卡面板内的登录页面未重定向登录页面。所有选项卡都是用usercontrols完成的,参考....
答案 0 :(得分:0)
您需要让登录页面脱离任何框架集,因此在登录页面的head
中添加以下JavaScript:
<script type="text/javascript">
if (parent.frames.length > 0) {
top.location.href = document.location.href;
}
</script>
答案 1 :(得分:0)
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="LogOn.Master.cs" Inherits="System.Web.Mvc.ViewMasterPage" %>
<head runat="server">
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<link href="../../App_Themes/PropelSkin/Stylesheet1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../Scripts/thickbox-min.js"></script>
<link rel="Stylesheet" href="../../Css/Thickbox.css" type="text/css" />
<script type="text/javascript">
if (parent.frames.length > 0) {
top.location.replace(document.location);
}
</script>
答案 2 :(得分:0)
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
$(function () {
var tabContainers = $('div.tabs > div');
$('div.tabs ul.tabNavigation a').click(function () {
tabContainers.hide().filter(this.hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
return false;
}).filter(':first').click();
});
</script>
<script src="../../Scripts/ajaxfileupload.js" type="text/javascript"></script>
<div class="content-admin">
<%
EmployeeDetails employeeDetails = null;
if (ViewData["EmployeeDetails"] != null)
employeeDetails = (EmployeeDetails)ViewData["EmployeeDetails"];
EmployeePersonalDetails personalDetails = null;
if (ViewData["PersonalDetails"] != null)
personalDetails = (EmployeePersonalDetails)ViewData["PersonalDetails"];
string entityName = new EmployeeDetails().EntityIdentifier;
if (employeeDetails != null)
{ %>
<div class="page-header">
<h1>
<%=employeeDetails.FirstName%>'s Profile
</h1>
<%-- column.ForColumn(col => Replace().SetFieldIdentifierAndPermissions("", PrivilegeConstant.DeleteEmployee).Named("Deactivate").DoNotEncode().Attributes(x => new Hash(@style => "font-weight:normal"));--%>
<table class="form-search" cellpadding="0" cellspacing="0">
<tr>
<td class="gridbg">
</td>
<td class="searchbg">
<table>
<tr>
<%
if (!string.IsNullOrEmpty(employeeDetails.UserId))
{
if (UserIdentity.HasPrivilege(CelloSaaS.ServiceContracts.AccessControlManagement.PrivilegeConstants.AddUserRole) &&
UserIdentity.HasPrivilege(CelloSaaS.ServiceContracts.AccessControlManagement.PrivilegeConstants.DeleteUserRole)
)
{
%>
<td>
<a class="thickbox" href="AddRoleSettings?width=375&height=245&userId=<%=employeeDetails.UserId %>&employeeId=<%=employeeDetails.Identifier %>"
title="Assign Roles" alt="Assign Roles">
<img src="../../App_Themes/PropelSkin/btn-assignroles.png" alt="Assign Roles" /></a>
</td>
<%}
} %>
<td>
<%--<div class="imageAlign">--%>
<a href="../History/History?entityName=<% =entityName %>&entityReferenceId=<%=employeeDetails.Identifier %>"
title="View History" alt="View History">
<img src="../../App_Themes/PropelSkin/btn-viewhistory.png" alt="View History" /></a>
<%--</div>--%>
</td>
<% if (UserIdentity.HasPrivilege(PrivilegeConstant.DeleteEmployee))
{ %>
<td>
<a href="DeleteEmployeeDetails?employeeId=<%=employeeDetails.Identifier %>" title="Deactivate Employee"
alt="Deactivate Employee">
<img id="deactivateemp" src="../../App_Themes/PropelSkin/btn-deactivate.png" alt="Deactivate Employee" /></a>
</td>
<%} %>
<% if (UserIdentity.HasPrivilege(PrivilegeConstant.ViewEmployee))
{ %>
<td>
<a href="EmployeeList">
<img src="<%= this.ResolveClientUrl("../../App_Themes/PropelSkin/btn-back.png")%>"
alt="Back To Employee List" /></a>
</td>
<%} %>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="profile-content-cntr">
<div class="profile-content-left">
<div class="profile-header">
<h1>
Summary</h1>
</div>
</div>
<div class="profile-content-right">
<div class="tabs">
<ul class="tabNavigation">
<li><a href="#EmployeeDetails" title="Organizational Info"><span>Organization</span></a></li>
<li><a href="#ManagePersonalDetails" title="Personal Info"><span>Personal</span></a></li>
<li><a href="#EmployeeEducationDetails" title="Education"><span>Education</span></a></li>
<li><a href="#EmployeeEmploymentHistory" title="Experience"><span>Experience</span></a></li>
<li><a href="#EmployeeCoOrganizationDetails" title="CoOrganizationDetails"><span>Co-Organization</span>
</a></li>
<li><a href="#EmployeeSkillSet" title="Skils"><span>Skills</span></a></li>
<li><a href="#EmployeeDocuments" title="Documents"><span>Documents</span></a></li>
<%-- <li><a href="#Skills" title="Skills">Skills</a></li>
<li><a href="#Skills" title="Projects">Projects</a></li>--%>
<%-- <li><a href="#Skills" title="Leaves">Leaves</a></li>--%>
<%--<li><a href="#Skills" title="Payroll">Payroll</a></li>--%>
</ul>
<a href="#" title="Next" class="imageNaviation">
<img src="../../App_Themes/PropelSkin/arrow-right.png" alt="Next" />
</a><a href="#" title="Previous" class="imageNaviation">
<img src="../../App_Themes/PropelSkin/arrow-left.png" alt="Previous" /></a>
</div>
</div>
</div>
<div class="form-content">
<div class="content-left">
<div id="EmployeeBasicDetails" class="profile-view">
<% Html.RenderPartial("ManageEmployeeBasicDetails"); %>
</div>
</div>
<div class="content-right">
<div class="right-panel">
<div class="profile-tabs">
<div class="tabs">
<div id="EmployeeDetails">
<% Html.RenderPartial("ManageEmployeeDetails"); %>
</div>
<div id="ManagePersonalDetails">
<% Html.RenderPartial("ManagePersonalDetails"); %></div>
<div id="EmployeeEducationDetails">
<% Html.RenderPartial("ManageEducationDetails"); %></div>
<div id="EmployeeEmploymentHistory">
<% Html.RenderPartial("ManageEmploymentHistory"); %></div>
<div id="EmployeeCoOrganizationDetails">
<% Html.RenderPartial("ManageCoOrganizationDetails"); %></div>
<div id="EmployeeSkillSet">
<% Html.RenderPartial("ManageEmployeeSkillSet"); %>
</div>
<div id="EmployeeDocuments">
<% Html.RenderPartial("ManageEmployeeDocuments"); %>
</div>
<%--<div id="Skills">
<% Html.RenderPartial("Skills"); %>
</div>
<div id="Skills">
<% Html.RenderPartial("Skills"); %>
</div>
<div id="Skills">
<% Html.RenderPartial("Skills"); %>
</div>--%>
<%-- </div>--%>
</div>
</div>
</div>
<%}
else
{ %>
<div>
<div class="profile-view">
<div class="profile-det">
<div class="notification-bg">
<div id="msg-failure">
<div class="header">
<img src="../../App_Themes/PropelSkin/fail-top1.gif" alt="" class="left" />
<img src="../../App_Themes/PropelSkin/fail-top2.gif" alt="" class="right" />
</div>
<div class="content">
<%=Html.CelloValidationMessage("EmployeeProfileMessage", new { @class = "exception" })%>
</div>
<div class="footer">
<img src="../../App_Themes/PropelSkin/fail-btm1.gif" alt="" class="left" />
<img src="../../App_Themes/PropelSkin/fail-btm2.gif" alt="" class="right" />
</div>
</div>
</div>
</div>
</div>
<%} %>
</div>
</div>
</div>
</div>