Image can't hold an image?

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
 
S

Steve C. Orr, MCSD

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.
 
G

Gary B

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
 
S

Steve C. Orr, MCSD

The ASPNET user account must have create/write privileges to whatever folder
you're trying to save to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top