Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have a server link like: http://document.aaaa.com
in dat i hve create a folder name pdf where 100s pdfs are store with name like
xyz_Q1,xyz_Q2...

through front end i m taking the value depending on some conditions as only "xyz".
now i want to retreive all the files from server name xyz like the ouput will be xyz_Q1,xyz_Q2 ans so on and clicking on the file i want to open the file from server on different tab.

i m not able to map with server through code. this i hve done with the folder keeping on my computer with the help of following code:

DirectoryInfo dinfo = new DirectoryInfo("..\\Portals\\PDFs");
C#
FileInfo[] finfo = dinfo.GetFiles(string.Format("{0}*.pdf", var));
            lstpdfs.Items.Clear();
            for (int i = 0; i < finfo.Length; i++)
            {

                list.Value = finfo[i].ToString();
                lstpdfs.Items.Add(list.Value);
            }


please suggest some way to do the above thing with the remote url as when i pass the url in the directory info i m getting the exception as we cant pass url. i also tried to do with server.mappath like:

DirectoryInfo dinfo = new DirectoryInfo(Server.MapPath("http://document.aaaa.com/foldername");

Please suggest how to solve
Posted

1 solution

In a client-server environment, it is always important to know where to run which program and how to communicate the results. Since your files are on a server with which you communicate via http, the code for filtering ought to be run on the server, too. That means, the code must be placed e.g. in an aspx page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900