catalyst2 community forums  

Go Back   catalyst2 community forums > Support > Scripting Support

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 28-06-2006, 07:03 PM   #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
dmeggs is offline   Reply With Quote
Old 29-06-2006, 08:49 AM   #2 (permalink)
Administrator
 
WhiskyFudge's Avatar
 
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
WhiskyFudge is offline   Reply With Quote
Old 29-06-2006, 12:21 PM   #3 (permalink)
Software / Web Developer
 
Join Date: Jul 2004
Location: Nottinghamshire, England
Posts: 158
Send a message via MSN to DaveLegg
Quote:
Originally Posted by WhiskyFudge
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.
*blinks*

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?
__________________
Dave Legg
www.dlpwd.co.uk
DaveLegg is offline   Reply With Quote
Old 29-06-2006, 03:31 PM   #4 (permalink)
Administrator
 
WhiskyFudge's Avatar
 
Join Date: Oct 2003
Posts: 1,484
Whisky Fudge ponders this
__________________
Jason Robbins
jason@catalyst2.com
WhiskyFudge is offline   Reply With Quote
Old 29-06-2006, 03:43 PM   #5 (permalink)
Administrator
 
WhiskyFudge's Avatar
 
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
WhiskyFudge is offline   Reply With Quote
Old 07-07-2006, 12:42 AM   #6 (permalink)
CAT5082
 
aMike's Avatar
 
Join Date: Jul 2004
Location: England, North Wales
Posts: 91
same error, obove root folder
CAT3539
www.idreams3d.net
__________________
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
aMike is offline   Reply With Quote
Old 08-07-2006, 10:31 AM   #7 (permalink)
Administrator
 
WhiskyFudge's Avatar
 
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
WhiskyFudge is offline   Reply With Quote
Old 16-11-2006, 08:57 AM   #8 (permalink)
CAT5082
 
aMike's Avatar
 
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
aMike is offline   Reply With Quote
Old 16-11-2006, 09:03 AM   #9 (permalink)
CAT5082
 
aMike's Avatar
 
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
aMike is offline   Reply With Quote
Old 16-11-2006, 09:34 AM   #10 (permalink)
Administrator
 
WhiskyFudge's Avatar
 
Join Date: Oct 2003
Posts: 1,484
Where are you trying to access?
__________________
Jason Robbins
jason@catalyst2.com
WhiskyFudge is offline   Reply With Quote
Old 16-11-2006, 09:43 AM   #11 (permalink)
CAT5082
 
aMike's Avatar
 
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
aMike is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:04 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.