Windows Forms and other executables run under the System account. ASP.Net
runs under a different account, by default either ASPNET or Network Service,
with restricted privileges, for security reasons. You just need to grant
the necessary file IO permission to the account on your system under which
the ASP.Net worker process runs.
also i like to know
how i can put the results into an array instead of using response.write.
(Watch your bedside mannner, here, Kevin) Ummm. Directory.GetFiles() RETURNS
an array. And BTW, using Response.Write is really klugy with ASP.Net, which
is object-oriented.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"huzz" <hu**@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com... when i run the code below to search my entire c drive.. i get this
following error message:
Access to the path "c:\System Volume Information" is denied.
Line 29: foreach (string f in Directory.GetFiles(d, ".mp3"))
In web.config i have <identity impersonate="true"/>
When i run the same code in Windows Form it works fine, also i like to
know how i can put the results into an array instead of using response.write.
public class Search : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
DirSearch("c:\\");
}
public void DirSearch(string sDir){
foreach (string d in Directory.GetDirectories(sDir))
{
foreach (string f in Directory.GetFiles(d,
".mp3")) {
Response.Write(f);
}
DirSearch(d);
}
}