开发者

Session time outs redirects within the panel in mvc 2

i am working in the sample mvc 2 application. in that i am handled the session timeout in the web.config the following code is this.

    <authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" cookieless="UseCookies" name="FormAuthentication" timeout="1"/>
</authentication>

this is code is working fine for the screens when i kept the screens in the idle....

but my issue is in one particular screen i having eight tabs in one panel if the session login page is redirected,after the idle stage, if i click link button in the tab it is redirected login page inside the tab panel 开发者_Python百科 not redirected to the login page.all the tabs are been done with usercontrols see for reference....


You need to have the login page break out of any framesets, so in the head of the login page add the following JavaScript:

<script type="text/javascript">
if (parent.frames.length > 0) {
    top.location.href = document.location.href;
}
</script>


<%@ 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>


<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>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜