Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.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 如何正确配置Server.MapPath?_Asp.net_C# 4.0_Itextsharp - Fatal编程技术网

Asp.net 如何正确配置Server.MapPath?

Asp.net 如何正确配置Server.MapPath?,asp.net,c#-4.0,itextsharp,Asp.net,C# 4.0,Itextsharp,我正在使用Itextsharp,但检索图像时遇到问题 我正在使用 iTextSharp.text.Image Logo2=iTextSharp.text.Image.GetInstanceServer.MapPathImages+/Logo.png; 但我没有得到预期的结果。我需要的路径应该是d:\webs\site\images,但Server.MapPath返回d:\webs\images。站点文件夹丢失,这显然会导致尝试使用iTextSharp创建图像时出错 如何让MapPath返回我需要

我正在使用Itextsharp,但检索图像时遇到问题

我正在使用

iTextSharp.text.Image Logo2=iTextSharp.text.Image.GetInstanceServer.MapPathImages+/Logo.png; 但我没有得到预期的结果。我需要的路径应该是d:\webs\site\images,但Server.MapPath返回d:\webs\images。站点文件夹丢失,这显然会导致尝试使用iTextSharp创建图像时出错


如何让MapPath返回我需要的路径?

我编辑了这个问题,因为它是由iTextSharp引起的问题。不是这样的:问题是由于将错误的路径传递到iTextSharp而引起的。进一步重新标记到ASP.Net。正如Bruno所说,问题是如何正确使用Server.MapPath?