简体   繁体   English

使用 .net 内核和 razor,我如何从 static 页面导航回 asp 菜单

[英]Using .net core and razor, how do I navigate back from a static page to the asp menu

I have successfully implemented static pages in asp.net core in the wwwroot folder.我已经在 wwwroot 文件夹的 asp.net 核心中成功实现了 static 页面。

I can navigate to those pages using the _layout menu.我可以使用 _layout 菜单导航到这些页面。

How do I navigate back from the static page to my asp.net razor home (index) page?如何从 static 页面导航回我的 asp.net razor 主页(索引)页面?

Below is an example.下面是一个例子。

在此处输入图像描述

In your _layout .在你的_layout中。

 <li class="nav-item">
     <a href="~/Test.html" class="nav-link text-dark">Test</a>
 </li>

Test.html:测试.html:

<body>
<h1>Test</h1>
<a href="/home/index">Back</a>
</body>

Test Result:测试结果: 在此处输入图像描述

Thanks for the response - but no joy.感谢您的回复-但不高兴。

I have tried the html file at various points in the wwwroot structure.我已经在 wwwroot 结构的各个点尝试了 html 文件。 This variant matches the suggestion: Snip of wwwroot此变体符合以下建议: Snip of wwwroot

I always manage to get to the html page on which I have:我总是设法进入我拥有的 html 页面:

Back to site返回网站

I have tried all sorts of variants (again) including adding /Pages/, leaving out the 'cshtml' and../ when in lower directories in wwwroot.我已经(再次)尝试了各种变体,包括在 wwwroot 的较低目录中添加 /Pages/、省略“cshtml”和../。

I am using net core 5 and Razor pages.我正在使用 net core 5 和 Razor 页面。

Any more suggestions?还有什么建议吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何导航到带有 ASP.net Core 按钮的新页面? - How do I navigate to a new page with a Button in ASP.net Core? 如何获取 onget 中的 ID 和 asp.net 核心 razor 页面中的使用处理程序? - How do I get the ID in onget and the use handler in asp.net core razor page? 在asp.net中,如何从网页中获取文本框值并将其作为值传递给<asp:HyperLink> - in asp.net, how do i take a textbox value from my page and pass it as a value to the navigate url of the <asp:HyperLink> ASP.Net剃刀页面-如何将JSON从剃刀页面返回到javascript $ .getJson? - ASP.Net Razor Pages - How do you return json from a razor page to javascript $.getJson? 如何呈现ASP .Net Core剃须刀页面的区域(PDF) - How to render area of ASP .Net Core razor page (for pdf) 如何处理 asp.net 核心 razor 页面中的路由? - how to handle routing in asp.net core razor page? 如何在 ASP.NET Core 中将控制器重定向到剃刀页面 - How to Redirect Controller to razor page in ASP.NET Core 如何在ASP.NET Core 2.0 Razor页面中填充dropdownlist - How to populate dropdownlist In ASP.NET Core 2.0 Razor page 如何使用 ASP.NET Core razor 页面中的地图跟踪位置? - how track location using maps in ASP.NET Core razor page? 如何将文件附件添加到从Razor页发送的电子邮件中(使用ASP.NET Core和MailKit) - How to add file attachment to Email message sent from Razor page (with ASP.NET Core and MailKit)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM