Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.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
C# ASP.NET MVC:获取子项目的路径&x27;s内容文件夹_C#_Asp.net Mvc_Document Root_Server.mappath_Subproject - Fatal编程技术网

C# ASP.NET MVC:获取子项目的路径&x27;s内容文件夹

C# ASP.NET MVC:获取子项目的路径&x27;s内容文件夹,c#,asp.net-mvc,document-root,server.mappath,subproject,C#,Asp.net Mvc,Document Root,Server.mappath,Subproject,我这里的问题有点混乱。目前,我有一个主(根)ASP.NET MVC项目,它位于基础上,而所有子项目都作为引用添加。我想使用子项目的内容文件夹,但不幸的是,Server.MapPath和Content.Url一直给我根项目的内容文件夹,而不是子项目的内容文件夹(项目输出到该文件夹) 我在StackOverflow中搜索了不少,但似乎大多数人都在试图找到主项目的路径,这不是我想要的。我正在从子项目的一个控制器调用此方法 提前非常感谢,圣诞快乐:)你可以给出这样的子项目的url filename=Pa

我这里的问题有点混乱。目前,我有一个主(根)ASP.NET MVC项目,它位于基础上,而所有子项目都作为引用添加。我想使用子项目的内容文件夹,但不幸的是,
Server.MapPath
Content.Url
一直给我根项目的内容文件夹,而不是子项目的内容文件夹(项目输出到该文件夹)

我在StackOverflow中搜索了不少,但似乎大多数人都在试图找到主项目的路径,这不是我想要的。我正在从子项目的一个控制器调用此方法


提前非常感谢,圣诞快乐:)

你可以给出这样的子项目的url

filename=Path.GetFileName(file.filename)

destinationPath=Path.Combine(Server.MapPath(“~/Images/”),文件名)


字符串url=“+filename+”&imagepath=“+destinationPath

希望这有助于您将子项目定义为自己的web应用程序,并在IIS中使用自己的工作进程?或者它们只是在文件夹中?