By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

IO Exception in ASP .NET

P: n/a
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
Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeas
help i spend alot of of time and failed to find any solution
great thanx for any 1 helps me

Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"si**********@gmail.com" wrote:
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
Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeas
help i spend alot of of time and failed to find any solution
great thanx for any 1 helps me

Nov 19 '05 #2

P: n/a
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: el**********@hotmail.com
<si**********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
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
Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeas
help i spend alot of of time and failed to find any solution
great thanx for any 1 helps me

Nov 19 '05 #3

P: n/a
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.

<si**********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
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
Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeas
help i spend alot of of time and failed to find any solution
great thanx for any 1 helps me

Nov 19 '05 #4

P: n/a
I haven't seen your code so I don't know where your bug is.
But I do have a working code sample for you so you can compare your code to
it:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<si**********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
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
Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeas
help i spend alot of of time and failed to find any solution
great thanx for any 1 helps me

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.