[英]My CSS Body styles not applying to login page
I'm having a stupid css issue I can't seem to figure out. 我有一个愚蠢的CSS问题,似乎无法弄清楚。 Here is my simple .css file:
这是我简单的.css文件:
#divBody
{
margin-left:25px;
}
#divTrans
{
margin:15px;
}
Body
{
background-color:Black;
}
I link this in my pages' tag like so: 我将其链接到页面标签中,如下所示:
<link rel="stylesheet" type="text/css" href="BodyLayout.css" />
The 'Body' style applies to all the pages in my site except my login page.. (index.aspx). “正文”样式适用于我网站中除登录页面之外的所有页面。(index.aspx)。 Here's the page's code in question:
这是有问题的页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
<!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 runat="server">
<link rel="stylesheet" type="text/css" href="BodyLayout.css" />
<title>Optoma USA - Login</title>
</head>
<body>
<center>
<div style="text-align:left; width:990px; height:780px; background-color:White;">
<div id="divBody">
<form id="form1" runat="server" target="_self">
<!--The rest isn't important, I don't think
When I inline the style, it works.. but not otherwise. 当我内联样式时,它可以工作..否则不能。 Like I said, it works in all of my other pages.
就像我说的,它可以在我的所有其他页面中使用。 Anyone know why this is happening?
有人知道为什么会这样吗?
Here's my entire web.config: 这是我的整个web.config:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<!--**Settings added for AJAX-->
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<!--**end added settings for AJAX-->
<appSettings/>
<connectionStrings>
<add name="OptomaLoanerConnectionString" connectionString="Data Source=OPTOSQL1;Initial Catalog=OptomaLoaner;User ID=sa;Password=tcnumberone" providerName="System.Data.SqlClient"/>
<add name="MAS200RAWConnectionString" connectionString="Data Source=OPTOSQL1;Initial Catalog=MAS200RAW;User ID=sa;Password=tcnumberone" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--**settings added for AJAX-->
<pages>
<controls>
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit"
assembly="AjaxControlToolkit"/>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls"
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<!--**end added settings for AJAX-->
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<!--**added assembly for AJAX-->
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<!--**end added assemblies for AJAX-->
</assemblies>
</compilation>
<!--**added for AJAX-->
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<!--**end added for AJAX-->
<!--<authentication> mode:forms;-->
<authentication mode="Forms">
<forms loginUrl="~/index.aspx" name="adAuthCookie" path="/">
</forms>
</authentication>
<!--<authorization>:-->
<authorization>
<!-- <deny>: will deny all users and redirect to login page,
unless they are properly authenticated-->
<deny users="?"/>
<!--<allow>: might be configured later. probably will not need-->
<allow users="*"/>
</authorization>
<!--<identity>: this might need to be set to true, and a default anonymous
account might have to be created in IIS at production time. refer to
http://msdn.microsoft.com/en-us/library/ms180890%28v=vs.80%29.aspx
for more information.-->
<identity userName="CTX_DOMAIN\ldapweb" password="ldap327714" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<!--*****added settings for AJAX-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<!--*****end added settings for AJAX-->
</configuration>
I had a similar problem, mine was to do with permissions. 我有一个类似的问题,我的是与权限有关。
Your login page has to be public (so that people can access it) but you CSS script is probably in a protected folder or has permissions set to hide it. 您的登录页面必须是公开的(以便人们可以访问它),但是CSS脚本可能位于受保护的文件夹中,或者已设置了隐藏它的权限。
See if putting your CSS in a public folder allows it to work. 查看将CSS放在公用文件夹中是否可以正常工作。
EDIT: Then it could be the individual file permissions in the web.config: 编辑:然后可能是web.config中的单个文件权限:
<location path="BodyLayout.css">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
I had a problem very similar to the one mentioned by Tony, and I solved it by granting permissions to whole Content folder with CSS
files in web.config
file: 我遇到了一个与Tony提到的问题非常相似的问题,我通过使用
web.config
文件中的CSS
文件向整个Content文件夹授予权限来解决了这个问题:
<location path="Content">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
Your CSS Body
tag doesn't match your body
(lower case B) in the html. 您的CSS
Body
标签与html中的body
(小写B)不匹配。 Use this: 用这个:
body {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.