Z
Zeb
Hi all
I've developed a shopping cart in C# and to allow moderators to upload
product images, news images and downloadable PDFs, the app creates a
folder for each product. I start out with the following empty folders:
/img/products/
/img/news/
/pdf/
When a new item is uploaded, the app first creates a folder in the
appropriate place and the folder is named using the product or news
ID. The uploaded files can also be deleted later if necessary.
This works fine locally, but won't work on the remote shared server.
When I try to create the folder on the uploaded website I end up with
the following exception:
"Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed"
I'm using DirectoryInfo.Create to create the new folders.
Interestingly, I wrote a quick ASP3 script that creates folders in the
root of the site and this works fine.
I did read a post yesterday that suggests the aspnet client needs read
access to the root of the physical drive (in this case, D to be able
to create folders and that most shared servers won't allow this.
Is this really the case, and if it is, what's the best solution? There
must be a way to dynamically create folders on shared hosting
servers ....
Many thanks for any helpful suggestions!
I've developed a shopping cart in C# and to allow moderators to upload
product images, news images and downloadable PDFs, the app creates a
folder for each product. I start out with the following empty folders:
/img/products/
/img/news/
/pdf/
When a new item is uploaded, the app first creates a folder in the
appropriate place and the folder is named using the product or news
ID. The uploaded files can also be deleted later if necessary.
This works fine locally, but won't work on the remote shared server.
When I try to create the folder on the uploaded website I end up with
the following exception:
"Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed"
I'm using DirectoryInfo.Create to create the new folders.
Interestingly, I wrote a quick ASP3 script that creates folders in the
root of the site and this works fine.
I did read a post yesterday that suggests the aspnet client needs read
access to the root of the physical drive (in this case, D to be able
to create folders and that most shared servers won't allow this.
Is this really the case, and if it is, what's the best solution? There
must be a way to dynamically create folders on shared hosting
servers ....
Many thanks for any helpful suggestions!