Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.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 在服务器MVC中将一个文件夹移回_Asp.net Mvc - Fatal编程技术网

Asp.net mvc 在服务器MVC中将一个文件夹移回

Asp.net mvc 在服务器MVC中将一个文件夹移回,asp.net-mvc,Asp.net Mvc,我需要在MVC项目的另一个项目中显示图像。从MVC访问图像时,我需要返回路径中的文件夹(或者不需要查看文件夹名称)。以下是视图\预订的控制器代码 public virtual ActionResult ResendEticket(BookingViewModel resendTicketModel) { if (ModelState.IsValid) { if(!string.IsNullOrEmpty(resendTicketM

我需要在MVC项目的另一个项目中显示图像。从MVC访问图像时,我需要返回路径中的文件夹(或者不需要查看文件夹名称)。以下是视图\预订的控制器代码

 public virtual ActionResult ResendEticket(BookingViewModel resendTicketModel)
    {
        if (ModelState.IsValid)
        {
            if(!string.IsNullOrEmpty(resendTicketModel.Email))
            {
                BookingService resendEticket = new BookingService();
                string result = resendEticket.ResendEticket(Convert.ToInt32(resendTicketModel.BookingReference), resendTicketModel.Email);

                if(!string.IsNullOrEmpty(result))
                {
                    ModelState.AddModelError(string.Empty, result);
                }
            }
        }

        ModelState.AddModelError(string.Empty, "Unable to do resend ticket due to system error");
        return RedirectToAction("Index", "Booking");
    }
我目前在接收端得到的路径是 C:\Projects\Booking\Invoices\Templates\images\logo\u eticket.png

我需要的是C:\Projects\Invoices\Templates\images\logo\u eticket.png

在接收端,我使用以下代码

TaxInvoiceFilePath = HttpContext.Current.Server.MapPath(mtxr.TaxInvoiceFilePath);
我可能无法更改上面的任何内容,因为这是与其他应用程序共享的。
如何将HttpContext.Current.Server.MapPath向后移动一步,以便一切正常

什么是
mtxr
?如何以及在何处设置该属性值?mtxr.TaxInvoiceFilePath值是从公共数据库获取的。为什么不首先正确存储它?正如所述,该值在不同的应用程序中使用,无法更新。因此,如果您试图删除字符串的
Booking
部分,您可以执行
替换(“Booking”,“”)