abdullah daoud
abdullah daoud

Reputation: 75

asp.net accessing a folder from webpage

so im trying to develop a website for a project, the thing is i have to do the following:

the admin must access a folder ( i need to put a button in the admin page so when pressed it opens a specific folder with sub-folders in it).

the folder is at the server.mappath it's at same level with app_data and so on.

i need a way to access it since when i try to do :

String foldername = "name";

Response.ContentType = "application/octet-stream";

Response.AppendHeader("content-disposition", "attachment;filename=" + foldername);

Response.TransmitFile(Server.MapPath("~/" + foldername));

Response.End();

I get an 'Access to the folder is Denied" error :/

please help i must do it for my project to work

Upvotes: 1

Views: 221

Answers (1)

abdullah daoud
abdullah daoud

Reputation: 75

Update:

just solved it myself, it appears i was using ".TransmitFile" which is for uploading files! used: System.Diagnostics.Process.Start("explorer.exe", @"put the physical path here"); and it worked like magic !! :D

Upvotes: 1

Related Questions