0

In my Web.Config file I have add my IP address in file path. when i try to access all files of that folder then it gives an error uri format not supported. but if i give local file path then it works fine.

string pathdata = Utility.GetConfigValue("DevSubmittedStateTaxForms");
string uploadPath = Utility.GetConfigValue("DevUploadFiles");

DirectoryInfo d = new DirectoryInfo(pathdata);
                FileInfo[] Files = d.GetFiles("*.pdf"); 

                var status = new List<Object>();
                int i = 1;
                foreach (FileInfo filename in Files)
                {
                    status.Add(new {ID = i, Name = filename.Name, URL = pathdata + filename.Name + ".pdf" });
                    i++;
                }
sbm6070
  • 45
  • 2
  • 7

1 Answers1

0
using System;
using System.IO;

namespace Test
{
    public class Program
    {
        static void Main(string[] args)
        {
            string pathdata = @"\\192.168.1.27\Temp\";

            var d = new DirectoryInfo(pathdata);
            var files = d.GetFiles("*.pdf");

            foreach (var filename in files)
            {
                Console.WriteLine(pathdata + filename.Name + ".pdf");
            }

            Console.ReadLine();
        }
    }
}

The above code does work (on my machine - that is my current IP address and a folder I have shared on my machine). Your code likely doesn't work for one of two reasons:

  1. Your path is not valid (e.g. using / instead of \)
  2. CBR folder is not shared
mjwills
  • 23,389
  • 6
  • 40
  • 63