Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc asp.net core 2.0无法获取css或查看页面的确切路径_Asp.net Mvc_Path_Asp.net Core 2.0_Nopcommerce 4.0 - Fatal编程技术网

Asp.net mvc asp.net core 2.0无法获取css或查看页面的确切路径

Asp.net mvc asp.net core 2.0无法获取css或查看页面的确切路径,asp.net-mvc,path,asp.net-core-2.0,nopcommerce-4.0,Asp.net Mvc,Path,Asp.net Core 2.0,Nopcommerce 4.0,net core 2.0和我有获取完整路径的问题,如下所示。如果您有任何想法,请给我解决方案 string filePath = Path.Combine(Path.Combine(Path.Combine(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"), "Demopath"), "Views"), "DemoViews"), "Views.cshtml"); 从这里我得到了这条路 D:

net core 2.0和我有获取完整路径的问题,如下所示。如果您有任何想法,请给我解决方案

 string filePath = Path.Combine(Path.Combine(Path.Combine(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"), "Demopath"), "Views"), "DemoViews"), "Views.cshtml");
从这里我得到了这条路

D:\ILYAS\\nop4.0\Presentation\Nop.Web\bin\Debug\net461\Plugins\Demopath\Views\DemoViews\Views.cshtml
但是我不需要
\bin\Debug\net461\

由于这一额外的行,我没有得到我的CSS和查看页面 有人知道吗?请告诉我


提前谢谢

路径似乎合适。 看看这条路

Plugins\Demopath\Views\DemoViews\Views.cshtml
这似乎很恰当

您在AppDomain.CurrentDomain.BaseDirectory上的问题

您可以使用存储url而不是BaseDirectory或其他内容

或者你可以转到根目录到Nop.Web

或者使用
Server.MapPath(“YourPath”)
使用直接路径

Server.MapPath
易于使用多次
路径。组合

使用此路径

Path.Combine(Environment.CurrentDirectory.ToString(), "Plugins", "MyDemo", "Content", "css", "style.css");

它会起作用的

不是答案,只是一个提示:你可以用多个参数写下:
Path.Combine(“一”、“二”、“三”、“四”、“五”、“六”)
删除多路径Combine thnx@MikeBovenlanderI很有帮助我尝试了这个方法,但它在.net core中的支持我尝试了不同的方法不需要两个答案,若你们在发布一个问题后得到了另一个解决方案,你们应该编辑第一个,然后只在那个里添加编辑。你可以随时编辑你的答案。@Div-谢谢,那时我还不知道。