2
後,我有一個主要的母版和三個從它繼承;我的網站改變根據用戶的狀態masterpages(已註銷,登錄時沒有管理員權限,登錄的管理員權限),以便適當地改變側面菜單。CSS渲染問題註銷
當我登錄時,母版頁normaluser.master和admin.master工作就好了。
當我退出,loggedout.master無法呈現從樣式表CSS的任何,把我的漂亮的小菜單進入下劃線的藍色鏈接的列表,並刪除所有標題樣式。
MasterPage.master:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-color: rgb(231, 231, 255);height:100%;margin:0px;padding:0px">
<form id="form1" runat="server">
<div style="background-color:rgb(74, 60, 140);color: rgb(247, 247, 247);height:20%">
<div style='width:7%;display:inline-block;border:none;padding:0px;padding-left:2px'>
<img src="Images/globe2.png" style="height:100px;vertical-align:middle"/>
</div>
<div style='display:inline-block;vertical-align:middle;'>
<span style='font-size:36pt;padding-left:10px;font-family:Century,inherit'> Welcome To MeetSmart: </span><span style="font-size:16pt;font-style:italic"> Your smarter meeting solution</span>
</div>
</div>
<div style="height:80%">
<div style='width:15%;height:100%;display:inline-block;text-align:center;margin-top:10px;padding:0px;'>
<asp:ContentPlaceHolder id="Menu" runat="server">
</asp:ContentPlaceHolder>
</div>
<div style='display:inline-block;margin:0px;padding-left:10px;padding-top:20px;border:2px solid purple;width:75%;height:100%;vertical-align:top'>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</body>
</html>
normaluser.master:
<%@ Master Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="normaluser.master.cs" Inherits="normaluser" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<title>
<asp:ContentPlaceHolder id="title" runat="server">
</asp:ContentPlaceHolder>
</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Menu" Runat="Server">
<div class='menuItem'> <a href="Schedule.aspx" class='menuItem'>My Schedule </a></div>
<div class='menuItem'> <a href="MyProfile.aspx" class='menuItem'>My Profile </a></div>
<div class='menuItem'> <a href="DocManagerUser.aspx" class='menuItem'>Document Center </a></div>
<div class='menuItem'> <a href="Directory.aspx" class='menuItem'>Directory</a></div>
<div class='menuItem'> <a href="Logout.aspx" class='menuItem'>Log out </a></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ContentPlaceHolder id="mainContent" runat="server">
</asp:ContentPlaceHolder>
</asp:Content>
loggedout.master:
<%@ Master Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="LoggedOut.master.cs" Inherits="LoggedOut" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link runat="server" href="StyleSheet.css" rel="stylesheet" type="text/css" />
<title>
<asp:ContentPlaceHolder id="title" runat="server">
</asp:ContentPlaceHolder>
</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Menu" Runat="Server">
<div class='menuItem'><a href="Login.aspx" class='menuItem'>Log In </a><br /></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ContentPlaceHolder id="mainContent" runat="server">
</asp:ContentPlaceHolder>
</asp:Content>
帶或不帶 「RUNAT =服務器」,在樣式表中的鏈接註銷不做任何事;補充說,這是我試圖解決它的一種方式。所有母版頁和樣式表都在同一個文件夾中。
它可以是一個訪問的東西,你需要改變在web.config?這登出用戶將無法訪問loggedout.master文件或CSS文件? – Niklas 2011-04-26 10:49:02
哇。對。我甚至沒有想到阻止訪問樣式表。做得很好。 – Yamikuronue 2011-04-26 10:52:10