gpt4 book ai didi

c# - 我的 CSS Body 样式不适用于登录页面

转载 作者:太空宇宙 更新时间:2023-11-03 22:07:14 24 4
gpt4 key购买 nike

我有一个愚蠢的 css 问题,我似乎无法弄清楚。这是我的简单 .css 文件:

#divBody
{
margin-left:25px;
}
#divTrans
{
margin:15px;
}
Body
{
background-color:Black;
}

我将其链接到我的页面标签中,如下所示:

<link rel="stylesheet" type="text/css" href="BodyLayout.css" />

“正文”样式适用于我站点中的所有页面,除了我的登录页面.. (index.aspx)。这是相关页面的代码:

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

当我内联样式时,它起作用了……但不是这样。就像我说的,它适用于我所有的其他页面。有人知道为什么会这样吗?

这是我的整个 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>

最佳答案

我有一个类似的问题,我的是与权限有关。

您的登录页面必须是公开的(以便人们可以访问它),但您的 CSS 脚本可能位于 protected 文件夹中或设置了隐藏它的权限。

看看将您的 CSS 放在公共(public)文件夹中是否可以正常工作。

编辑:那么它可能是 web.config 中的单个文件权限:

<location path="BodyLayout.css">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>

关于c# - 我的 CSS Body 样式不适用于登录页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4928087/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com