IO Exception in ASP .NET

S

silvia.rafat

Dear,
i'm developping a web application that where clients may
1- upload images to DB (SQL Server).
2- view the image from DB.

i store the images in DB through the data type 'image'
to upload images i open a file stream (on client machine) and read the
data from the image file as byte()

the same way i do for viewing the images

i creat a temperory file stream (on server) and read the byte() from db
so i can give the image web control a path to show the image
[i failed to find another way :( , or even creat a file on client
machine ]

the problem i had is the IO Exception access denied in both reading and
writing the file stream, i even changed the defaul windows
authentication...
to forms authentication.. & still give me the same exception althought
when i traced the User.Identity ..he is login & authenticated
Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeas
help i spend alot of of time and failed to find any solution
great thanx for any 1 helps me
 
G

Guest

Hi Silvia
try to upload ur image in the server and save in the db only the filename
when u request it from ur application dowunload it and pass from ur web
application the filename
try this maybe it's work
i try it before
 
E

Elmer Carías

if you are using impersonate=true then you have to give rigths in the folder
of ourt application , but if you dont use that, you have to give full rigths
to APSNET account for the directory where you are saving the file.

Elmer Carías
El Salvador, CA
MSN: (e-mail address removed)
 
K

Kevin Spencer

I'm not sure we know each other well enough for you to call me "Dear" but
I'll take it as a sign of general friendliness. ;-)

I could go over how to set the permissions you need, but in fact, you don't
need any. It isn't necessary to create a Temp File. You can use a
MemoryStream instead of a Filestream, and read the data into the
MemoryStream and then stream it to the browser. Now, you're about to ask,
how are you supposed to put an image link into an HTML page without a file?
Excellent question, Silvia! You do it by creating an ASPX page that serves
as the "file." It sets the Response.ContentType to "image/jpeg" (or whatever
MIME type you're sending), and saves the image to the Response.OutputStream.
The browser then ingores the file extension, and uses the MIME type to
display the dynamically-generated image. You just put the ASPX page's URL
into an image tag as you would with any image file.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top