背景:用到Xslt技术,请求页面是xml
先上WebConfig配置文件
- XML code
<system.web> <compilation debug="true" targetFramework="4.0" /> <customErrors mode="On" defaultRedirect="ErrorHandling.aspx"> <error statusCode="403" redirect="NotFound.aspx" /> <error statusCode="404" redirect="NotAcciess.aspx" /> </customErrors> <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> <!--其他节点就不在这里写了--> </system.web>
aspx页面,模板页,vs生成页面不做任何改动,添加两个请求页面
- HTML code
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <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> 我的 ASP.NET 应用程序 </h1> </div> <div class="loginDisplay"> <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"> <AnonymousTemplate> [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">登录</a> ] </AnonymousTemplate> <LoggedInTemplate> 欢迎使用 <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>! [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="注销" 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="主页"/> <asp:MenuItem NavigateUrl="~/About.aspx" Text="关于"/> <asp:MenuItem NavigateUrl="~/pages/341181100000000027/2a53515a-9770-444a-bc98d181a3f61e.xml" Text="xml测试错误"/> <asp:MenuItem NavigateUrl="~/pages/341181100000000027/2a53515a-9770-444a-bc9e-8d181ad3f61e.xml" Text="正常页面"/> <asp:MenuItem NavigateUrl="~/Abot.aspx" Text="普通页面测试"/> </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>