Joshua Van Hoesen
Joshua Van Hoesen

Reputation: 1732

.aspx page does not render correctly

Problem:

.aspx pages will not render the css associated with on the masterpage

to see image hold down ctrl and use your mouse wheel to zoom in

enter image description here

Setup:

  1. IIS 7 windows 2008 r2 server
  2. .Net framework 4.0
  3. I have used the aspnet_regiis.exe -i
  4. Static content is enabled
  5. Already had a site running, created a virtual directory within its hierarchy and placed the files within

Page Directive of screenshot page:

<%@Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Solomon Conversion.aspx.cs" Inherits="AcuFinal.Solomon_Conversion" %>

Asp.Net Code of Master Page:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    AcuConvert
                </h1>
            </div>
            <div class="loginDisplay">
                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
            <div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                        <asp:MenuItem NavigateUrl="~/Conversion Data Validation.aspx" 
                            Text="Conversion Data Validation" Value="Conversion Data Validation"/>
                        <asp:MenuItem Text="Solomon Conversion" Value="Solomon Conversion" 
                            NavigateUrl="~/Solomon Conversion.aspx">
                        </asp:MenuItem>
                    </Items>
                </asp:Menu>
            </div>
        </div>
        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">

    </div>
    </form>
</body>
</html>

Upvotes: 0

Views: 2394

Answers (2)

ChiYoung
ChiYoung

Reputation: 856

try :

<link href="<%=Url.Content("~/Styles/Site.css") %>" rel="stylesheet" type="text/css" />

Upvotes: 1

Igor
Igor

Reputation: 15893

 <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />

should be

 <link href="<%= Page.ResolveUrl("~/Styles/Site.css") %>" rel="stylesheet" type="text/css" />

as should the rest of urls containing virtual path when they are not properties of server controls.

Upvotes: 1

Related Questions