Image can't hold an image?

  • Thread starter Thread starter Gary B
  • Start date Start date
G

Gary B

I'm converting a windows application to a web application. (by the way,
this is way easier than it used to be - many of the modules went over
untouched!)

The windows app used a pictuebox and got an image directly from a sqlserver
database. Upon examination of the Image web control, it seems the imageURL
property must come from a file? Is they anyway to directly feed it a vb.net
image object?
Thanks,
Gary
 
No, you must use an image tag which links to a file. It doesn't have to be
a picture file though. You could link it to a ASPX page that dynamically
outputs the image.
 
Steve,
I had actually tried something like that earlier with
environmanet.currentdirectory but I changed my code to read as follows after
your suggestion:


FilePath = Server.MapPath("/DBAPhotoQuery")
FilePath = FilePath & "\currentPic.jpg"


--> at this point filePath is:
c:\inetpub\wwwroot\DBAPhotoQuery\currentPic.jpg


myImage.Save(FilePath, Imaging.ImageFormat.Jpeg)
DBAPictureBox1.ImageUrl = FilePath

This also gets a generic GDI + exception.
but if I insert:
FilePath = "c:\currentpic.jpg"
just before the myImage.save then it works!!

I've checked very carefully and the c:\inetpub.... string is valid. Maybe
its security related??
I appreciate the help so far,
Thanks
Gary
 
The ASPNET user account must have create/write privileges to whatever folder
you're trying to save to.
 
Back
Top