Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 13, 2010 05:31 PM by dude9er
Apr 10, 2010 06:20 PM|LINK
I am using ClubStarter Kit with goDaddy and recently came across a new error when uploading an image to a gallery. In the past the process worked fine, but recently it has stopped working and throws an error. GoDaddy may changed something on their server
to stop the write to the database. Can someone please help me with this new error?
Here it is:
Line 57: newThumb.Close()Line 58: Line 59: Image.Insert(title, filename, albumid, "")Line 60: Line 61: Dim newimg As New Image(Image.Columns.ImageFileName, filename)
Source File: D:\Hosting\5833289\html\App_Code\BLL\ImageHandling.vb Line:
Apr 11, 2010 01:56 AM|LINK
If you haven't changed anything in your application configuration file regarding application's trust level AS IT SAYS IN THE SECURITY EXCEPTION, you will definitely need to contact the hosting provider (GoDaddy) and explain your problem in details so that
they will inform you with accurate info about what did they changed or any other info from their side.
Maybe someone else have had similar experience and may give you more accurate answer, but still I think you will have to contact your hosting company for this issue.
Apr 12, 2010 07:20 PM|LINK
This error indicate your application is trying to write to the file system outside of your virtual directory which is prohibited under Medium Trust.
I don't believe goDaddy allows you to elavate the trust level.
Apr 12, 2010 07:33 PM|LINK
Hi Bruce, thanks for the feedback. I spoke with GoDaddy and the rep said that in ASP.Net 1.1 the full trust level is available. Of course using older languauge limits what the app can and can't do.
The piece of code in question is this (line 38 is throwing the error):
Public Shared Function uploadImage(ByVal title As String, ByVal albumid As Integer, ByVal data As IO.Stream, Optional ByVal path As String = "") As Integer
Dim origImageData(CInt(data.Length - 1)) As Byte
data.Read(origImageData, 0, CInt(data.Length))
Dim imgStore As ImageLocation = GetLocation()
If imgStore = ImageLocation.Database Then
Images.Insert(title, MakeThumb(origImageData, 350), MakeThumb(origImageData, 69, 69), origImageData, albumid, "")
Dim imgs As New Images(Images.Columns.Origimage, origImageData)
If imgs.IsLoaded = True Then
ElseIf imgStore = ImageLocation.FileSystem Then
If Not Directory.Exists(path) Then
Dim filename As String = Now.Year & Now.DayOfYear & Now.Hour & Now.Minute & Now.Second & Now.Millisecond & ".jpg"
Dim thumbLargeImage As Byte() = MakeThumb(origImageData, 350)
Dim thumbSmallImage As Byte() = MakeThumb(origImageData, 69, 69)
Dim newImageFile As FileStream = New FileStream(path & filename, FileMode.Create)
newImageFile.Write(origImageData, 0, origImageData.Length)
Dim newThumbFile As New FileStream(path & "large" & filename, FileMode.Create)
newThumbFile.Write(thumbLargeImage, 0, thumbLargeImage.Length)
Dim newThumb As New FileStream(path & "tmb" & filename, FileMode.Create)
newThumb.Write(thumbSmallImage, 0, thumbSmallImage.Length)
Image.Insert(title, filename, albumid, "")
Dim newimg As New Image(Image.Columns.ImageFileName, filename)
If newimg.IsLoaded = True Then
Is there another way of inserting this into data into the database? This is the last peice of the puzzle. I'm sure this insertion was working back in August 2009 when I first launched the site. Seems to me goDaddy made some changes and broke the darn thing.
Also, what other hosting companies offer .net FULL Trust as part of their hosting? I need to get out of the GoDaddy realm if this is going to continue to happen.
Thanks again for your feedback.
Apr 12, 2010 09:05 PM|LINK
Jes.. only 1.1 offers full trust.. in case you don't realized, asp.net 4.0 was released today. Going back to 1.1 is like going back 2 generations.
Is there another way of inserting this into data into the database?
I think your code already has the ability to insert the image into the DB.
# If imgStore = ImageLocation.Database Then
# Images.Insert(title, MakeThumb(origImageData, 350), MakeThumb(origImageData, 69, 69), origImageData, albumid, "")
# Dim imgs As New Images(Images.Columns.Origimage, origImageData)
# If imgs.IsLoaded = True Then
# Return imgs.Id
# Return 0
# End If
Also, what other hosting companies offer .net FULL Trust as part of their hosting?
You can check out our hosting service. http://www.discountasp.net
Apr 13, 2010 05:31 PM|LINK
Thanks for the feedback. I was actually able to get it to work using a SQLConnection