Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.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# 在服务器中发布网站时是否显示图像?_C#_Asp.net - Fatal编程技术网

C# 在服务器中发布网站时是否显示图像?

C# 在服务器中发布网站时是否显示图像?,c#,asp.net,C#,Asp.net,我使用下面的代码来保存图像 if (RadUploadPageImage.UploadedFiles.Count != 0) { foreach (UploadedFile file in RadUploadPageImage.UploadedFiles) { targetFolder = "/ADDS/"; targetFileName = Path.Combine(targetFolder, file.GetNameWithoutE

我使用下面的代码来保存图像

 if (RadUploadPageImage.UploadedFiles.Count != 0)
 {
     foreach (UploadedFile file in RadUploadPageImage.UploadedFiles)
     {
         targetFolder = "/ADDS/";
         targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
         string folderpath = Server.MapPath(@targetFileName);
         while (File.Exists(folderpath))
         {
             counter++;
             targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
             break;
         }
         for (int i = 0; i < RadUploadPageImage.AllowedFileExtensions.Length; i++)
         {
             if (file.GetExtension().ToString() == AllowedFileExtensions[i])
             {
                 file.SaveAs(this.Server.MapPath(targetFileName));
                 path = targetFileName;
                 break;
              }
              else
              {
                  ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "aa", "<script>alert('Image should be in .jpg, .jpeg, .png, .gif,.bmp,.tiff');break;</script>", false);
              }
          }
if(RadUploadPageImage.UploadedFiles.Count!=0)
{
foreach(RadUploadPageImage.UploadedFiles中的UploadedFile文件)
{
targetFolder=“/ADDS/”;
targetFileName=Path.Combine(targetFolder,file.GetNameWithoutExtension()+counter.ToString()+file.GetExtension());
字符串folderpath=Server.MapPath(@targetFileName);
while(File.Exists(folderpath))
{
计数器++;
targetFileName=Path.Combine(targetFolder,file.GetNameWithoutExtension()+counter.ToString()+file.GetExtension());
打破
}
对于(int i=0;i
发布时未显示图像。在服务器中发布网站时如何显示图像。请告诉我

在我的系统中运行代码时,我能够显示上传的图像。 在发布路径中,我无法播放上载的图像


请告诉我出了什么问题?

我认为问题在于发布服务器上图像的url,您可以查看html的源代码,查看图像的url并检查其是否正确