I am having a touble with selecting and viewing pdf and word files from hard disk in asp.net .
can someone tell me how.
Please put codings.....
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 15, 2010, 7:32 AM EDT
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 14, 2010, 4:01 AM EDT
sam jdam11 reputationPosted Apr 14, 2010, 5:16 AM EDT
But please tell me, how to get a list of files on a hard disk folder to the web page, and then view them one by one using the
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 14, 2010, 8:23 AM EDT
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 14, 2010, 9:14 AM EDT
sam jdam11 reputationPosted Apr 15, 2010, 5:24 AM EDT
_______________________________________________________________
void Page_Load(object s, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo("E:\\Backup\\Documents");
FileInfo[] rgFiles = di.GetFiles("*.pdf");
foreach (FileInfo fi in rgFiles)
{
Response.Write("
" + fi.Name + "");
}
}
_______________________________________________________________
I can see all the files in the directory, but i can't click and open any of them.
I can click and read the pdf file, only if that file is in the project folder. If the file is not in the project folder an error is shown.
So how to generate a href link with reference to a specific folder on hard disk............eg: path -"E:\\Backup\\Documents".
sam jdam11 reputationPosted Apr 15, 2010, 4:55 PM EDT
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 16, 2010, 3:51 AM EDT
sam jdam11 reputationPosted Apr 16, 2010, 5:43 AM EDT
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 16, 2010, 7:46 AM EDT