Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
661 views
in Technique[技术] by (71.8m points)

asp.net-mvc - Razor Pages ASP.NET标记辅助程序未重定向未正确生成引用(asp.net核心2.1)(Razor Pages ASP.NET tag helpers not redirecting not generating ref correctly (asp.net core 2.1))

While updating my app to use the razor pages structure in ASP.NET Core 2.1 from MVC, some of my links stopped working.

(在更新我的应用程序以使用MVC的ASP.NET Core 2.1中的剃须刀页面结构时,我的某些链接停止了工作。)

Basically - when doing asp-page="Example" The generated code will be

(基本上-做asp-page="Example" ,生成的代码将是)

site?page=Example

insted of

(装的)

site/Example

This happens when trying to use asp-controller, asp-area and any other taghelper , same as in the asp-page example

(尝试使用asp-controller,asp-area和任何其他taghelper时会发生这种情况 ,与asp-page示例中的相同)

This only happens on a specific page - happens to be the Home/Index page.

(这仅在特定页面上发生-恰好是“主页/索引”页面。)

Here are the relevant parts from Startup.cs

(这是Startup.cs中的相关部分)

ConfigureServices:

(ConfigureServices:)

 services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

Configure:

(配置:)

app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
  ask by George97 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...