Get directory using ASP.Net in GoDaddy

I needed to retrieve the files in a directory hosted with GoDaddy using ASP.Net C# and I got an error using Directory.GetFiles()—specifically, this error:

Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

So, I looked around and came up with this:


Works like a charm!

About admin