473,508 Members | 2,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IO Exception in ASP .NET

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
4 1313
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2745
by: Nicolas Fleury | last post by:
Hi, I've made a small utility to re-raise an exception with the same stack as before with additional information in it. Since I want to keep the same exception type and that some types have very...
1
4198
by: Old Wolf | last post by:
1. What is the difference between #include <stdexcept> and #include <exception> ? 2. Is there a list somewhere of what each standard exception is used for? either to throw them, or throw...
11
3251
by: Master of C++ | last post by:
Hi, I am writing a simulation package in C++, and so far I've written about 8000 lines of code and have about 30 classes. I haven't used C++ exceptions so far (for various reasons). The only two...
4
15797
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
44
4162
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
40
13468
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
6
1748
by: Vadivel Kumar | last post by:
I've a problem in handling a custom exception The following is my custom exception class: public class AppException : public Exception { public AppException (string message, Exception...
3
2499
by: JohnDeHope3 | last post by:
First let me say that I understand that Asp.Net wraps my exception in an HttpUnhandledException. I have found a lot of discussion about that on the web, which was informative, but not helpful. Let...
7
5084
by: Sek | last post by:
Hi Folks! I was pondering over a code and noticed that exception handlers were present in the private, protected as well as public methods. And, ofcourse, public methods were calling priv/prot...
2
6957
by: Darko Miletic | last post by:
Recently I wrote a dll in c++ and to simplify the distribution I decided to link with multithreaded static library (/MT or /MTd option). In debug everything works fine but in release I get this: ...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.