![]() |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jun 2006
Posts: 1
|
.NET Image Uploading
Hi All,
I have written some VB .NET code that takes a image file re-sizes it, water marks it and uploads it to my website. When I run the code on my local PC it works fine however when I have tried it on the catalyst2 website it fails. I have received various errors all to do with security (I believe). Here is a small snippet of code: Dim objImage As System.Drawing.Image objImage = objImage.FromStream(Me.fileUpload.PostedFile.Input Stream) objImage.Save(strNewFileNameAndPathForImage) The last line is where I get the error. If I try to upload the file to the DB folder then I get the following error message: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Any help would be greatly appreciated - thank you. Daniel Meggs |
|
|
|
|
|
#2 (permalink) |
|
Administrator
Join Date: Oct 2003
Posts: 1,484
|
Due to the security policy the Catalyst2 operate an ASP.net application can not access folders above it's application root. So you'll need to save your images somewhere other than then db folder.
__________________
Jason Robbins jason@catalyst2.com |
|
|
|
|
|
#3 (permalink) | |
|
Software / Web Developer
|
Quote:
Isn't the point of the db folder to store databases? Therefore applications running in wwwroot would need to be able to access that folder surely? |
|
|
|
|
|
|
#5 (permalink) |
|
Administrator
Join Date: Oct 2003
Posts: 1,484
|
As I thought, my test site on coconut shows that I can't access anything above the app root. That includes the DB folder. However my access test (db in the db folder) works fine. I'll get my head around this logic latter.
I personally think that any asp.net application should be given access to everything below D:\Domains\domain.com\ (not full access mind, that would be a support nightmare!). However the man at Cat2 has decided on this security policy. For the majority of users it is fine and very sensible. Especially when you think of the skill set of some of the potential users, and the fact its shared hosting. So dmeggs I'm afraid you'll have to change where you wish to store your images.
__________________
Jason Robbins jason@catalyst2.com |
|
|
|
|
|
#6 (permalink) |
|
CAT5082
Join Date: Jul 2004
Location: England, North Wales
Posts: 91
|
__________________
Server 2003 sp1, AMD 64 3000+, Aopen, 1GB 400DDR RAM, GF4 ti 4400, Audigy 2, 2x160gig sata HD. cat2 webserver: strawberry isp: demon internet ip: 80.177.1.17 www.idreams3d.net www.walesdates.co.uk |
|
|
|
|
|
#7 (permalink) |
|
Administrator
Join Date: Oct 2003
Posts: 1,484
|
Just to keep you all updated. It does appear that there is an issue with some permissions on strawberry. I've chased this up with Cat2 staff and hopefully it'll be fixed soon.
__________________
Jason Robbins jason@catalyst2.com |
|
|
|
|
|
#8 (permalink) |
|
CAT5082
Join Date: Jul 2004
Location: England, North Wales
Posts: 91
|
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Demons back again ? Strawbery! I want to mubble something, but i will bite my tounge.
__________________
Server 2003 sp1, AMD 64 3000+, Aopen, 1GB 400DDR RAM, GF4 ti 4400, Audigy 2, 2x160gig sata HD. cat2 webserver: strawberry isp: demon internet ip: 80.177.1.17 www.idreams3d.net www.walesdates.co.uk |
|
|
|
|
|
#9 (permalink) |
|
CAT5082
Join Date: Jul 2004
Location: England, North Wales
Posts: 91
|
Balls... just remembed..
FileInfo is not allowed.. have to stop doing that!
__________________
Server 2003 sp1, AMD 64 3000+, Aopen, 1GB 400DDR RAM, GF4 ti 4400, Audigy 2, 2x160gig sata HD. cat2 webserver: strawberry isp: demon internet ip: 80.177.1.17 www.idreams3d.net www.walesdates.co.uk |
|
|
|
|
|
#11 (permalink) |
|
CAT5082
Join Date: Jul 2004
Location: England, North Wales
Posts: 91
|
Thanks Whisky, its ok though I just forgot that fileinfo function is not allowed, so I just removed it and it works ok..
Should make a note of that really.. Cheers for reply!
__________________
Server 2003 sp1, AMD 64 3000+, Aopen, 1GB 400DDR RAM, GF4 ti 4400, Audigy 2, 2x160gig sata HD. cat2 webserver: strawberry isp: demon internet ip: 80.177.1.17 www.idreams3d.net www.walesdates.co.uk |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|