gpt4 book ai didi

Area is not Working in Asp dot net Core 6(区域在Asp dot net中不工作Core 6)

转载 作者:bug小助手 更新时间:2023-10-22 15:47:01 27 4
gpt4 key购买 nike



enter image description here

在此处输入图像描述


enter image description here

在此处输入图像描述


enter image description here

在此处输入图像描述


https://localhost:7082/EmpList/EmployeeData/Index

when request pass the "return View()" then it can not identify view page and i want "localhost:7082" show then show the Index page directly . but i does not work

https://localhost:7082/EmpList/EmployeeData/Index当请求通过“return View()”时,它无法识别视图页面,我希望“localhost:7082”显示,然后直接显示索引页面。但我不工作


更多回答

Please do not upload images of code/data/errors.

请不要上传代码/数据/错误的图像。

优秀答案推荐

I have seen your images and found that you have hard coded the end points with EmpList. Instead that you should do the following

我看过你的图片,发现你已经用EmpList硬编码了终点。相反,您应该执行以下操作


endpoints.MapControllerRoute("area", "{area:exists}/{controller=Home}/{action=Index}/{id?}");

And then in controller, you need to specify the area like below. This single configuration will work for multiple areas

然后在控制器中,您需要指定如下区域。此单一配置适用于多个区域


[Area("Products")]
public class ProductController: Controller
{
}


[Area("EmpList")]
public class EmployeeDataController: Controller
{
}


更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com