我的asp網絡應用程序有幾個母版頁。即使我輸入錯誤的網址(www.domain.com/lwkenfldskfnslkfnsldkfnsdlkfnsdlkfn),母版頁也會呈現網站的頁眉和頁腳以及其他一些內容,而不是顯示iis默認的404頁面錯誤。請幫助即使輸入了錯誤的頁面url,我的asp web應用程序母版頁仍在渲染
我的錯誤頁面
<%@ Page Title="" Language="C#" MasterPageFile="~/error.Master" AutoEventWireup="true" CodeBehind="404.aspx.cs" Inherits="DiwanAlwan.error404" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="error-404 background background-color-dark background-image-main-404">
<div class="fp-table">
<div class="fp-table-cell center"
<div class="container">
<div class="margin-bottom-40">
<h1><span class="page">page</span><span>404</span></h1>
<h2>The product not found</h2>
</div>
<p>
<span>Please try one of the following pages</span>
<a href="#" class="btn btn-lg btn-primary margin-left-10">Home Page</a>
</p>
</div><!-- /.container -->
</div>
</div>
</div><!-- /.error-404 -->
</asp:Content
我的web配置:
<customErrors mode="On" defaultRedirect="~/404.aspx">
<error statusCode="404" redirect="~/404.aspx" />
</customErrors>
我的母版頁:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="error.master.cs" Inherits="DiwanAlwan.error" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
你需要發佈你的'web.config'和你的自定義錯誤頁 –
發佈您的'404.aspx'頁面以及 –