473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem in ASP.Net File Upload Application

The basic purpose of the site is for authenticated users to post event
listings, which often include photographs. The user is faced with a page
where they can insert all of the information about the event in a typical
form with textboxes, drop down lists, etc. On this page there are also 4
file upload controls where the user can select 0 to 4 images on their file
system for inclusion in the event listing. On submit, the images (if any)
are uploaded to the server and named based on the user id and picture number,
eg. 123456_01.jpg, 123456_02.jpg, etc. The user is shown a preview of the
event with the images. On submit the event is inserted in the database with
a return value of the pk or EventID number. This number is used to rename
the images, eg. 123456_01.jpg becomes 9876_01.jpg, 123456_02.jpg becomes
9876_02.jpg.

This generally works very well. The image upload directory is directly
under the root of the website and has full control for ASP.Net, Network
Service, Everyone. this is IIS6 on Server 2003. However, a very small
portion of our users report that when they go to upload more than one event,
when the preview shows up for the second event, the photos from the first
event show up. We also get reports that if they "shut down the computer and
reopen it" between each listing it works ok. This is not acceptable since we
get paid by the listing. I have requested of some users that they clear
their browser cache, delete all temporary files and cookies, and try again
but these users report that it still occurs.

Is this a file upload permissions problem, or is it somehow that images are
being cached somewhere since the name of the images on the preview page is
the same (username + image number + .jpg)?

If this is a caching problem is there some way to make sure that images are
not cached anywhere? What tags, if any can be used on the pages, or settings
in iis?
Nov 19 '05 #1
3 3037
Would like help on this issue as the 48 hr response time has elapsed, so let
me further elaborate.

Because the image is always temporarily saved as the userId + extension then
for every event the image will have the same name as the previous event and
the one before that etc., but only when the event is saved is and eventId
generated, and so the image is then renamed to eventId + extension. User
then goes to add another event, uploads his description and pic, and then
there is the previous picture and not the one he just uploaded, preventing
the user from uploading any more events, and thus preventing us from earning
any money, causing my boss to bug me about fixing it, causing me to post here
where we are supposedly getting a response from Microsoft within 48 hours.

When this first started occuring I assumed it to be file permission problem
on the new server, but I went ahead and gave the Network Service account full
control over the imageUpload directory, which is under the website. Does
anyone have any opinions about this? Should Network Service have such
privilege, is having the directory under the website causing IIS to become
adversely involved in this somehow?

Since I thought it also might be that file upload control itseltf or the
resizing events were not releasing their references or holds or whatever on
these files, I went back and wrote a boatload of things like

Finally
rawBitmap = Nothing
resizedBitmap = Nothing
postedFile = Nothing

But then since every file gets renamed to the eventId + extension...Its
probably superfluous?

Then I think, what else could it be? It has te be an image stuck downstream
in a client or proxy cache? Isnt that what a cache does, prevents grabbing a
new version of something, and since the old image was username+extension and
the new image is also called username+extension is ist simply not getting the
latest image and so our clients look at the event preview and even though
their image was uploaded (?) they see the old image and freak out?

If this is the case, a MS engineer would probably say something like, ah ha
see, not a bug or problem in VS, but a problem somewhere else, case closed.
And yet I wrote an application that doesn't work for some users in some
situations and I need to fix it. If this is indeed what is happening (I have
no idea really) is there a better way to engineer the application such that
this will not happen to any users?

"Pitcairnia" wrote:
The basic purpose of the site is for authenticated users to post event
listings, which often include photographs. The user is faced with a page
where they can insert all of the information about the event in a typical
form with textboxes, drop down lists, etc. On this page there are also 4
file upload controls where the user can select 0 to 4 images on their file
system for inclusion in the event listing. On submit, the images (if any)
are uploaded to the server and named based on the user id and picture number,
eg. 123456_01.jpg, 123456_02.jpg, etc. The user is shown a preview of the
event with the images. On submit the event is inserted in the database with
a return value of the pk or EventID number. This number is used to rename
the images, eg. 123456_01.jpg becomes 9876_01.jpg, 123456_02.jpg becomes
9876_02.jpg.

This generally works very well. The image upload directory is directly
under the root of the website and has full control for ASP.Net, Network
Service, Everyone. this is IIS6 on Server 2003. However, a very small
portion of our users report that when they go to upload more than one event,
when the preview shows up for the second event, the photos from the first
event show up. We also get reports that if they "shut down the computer and
reopen it" between each listing it works ok. This is not acceptable since we
get paid by the listing. I have requested of some users that they clear
their browser cache, delete all temporary files and cookies, and try again
but these users report that it still occurs.

Is this a file upload permissions problem, or is it somehow that images are
being cached somewhere since the name of the images on the preview page is
the same (username + image number + .jpg)?

If this is a caching problem is there some way to make sure that images are
not cached anywhere? What tags, if any can be used on the pages, or settings
in iis?

Nov 19 '05 #2
Add a QueryString with a random number to the image URL (e.g.
"/images/12345.jpg?n=520"). This will fool the browser into thinking that it
is not the same image, and it will request it from the server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Pitcairnia" <Pi********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Would like help on this issue as the 48 hr response time has elapsed, so
let
me further elaborate.

Because the image is always temporarily saved as the userId + extension
then
for every event the image will have the same name as the previous event
and
the one before that etc., but only when the event is saved is and eventId
generated, and so the image is then renamed to eventId + extension. User
then goes to add another event, uploads his description and pic, and then
there is the previous picture and not the one he just uploaded, preventing
the user from uploading any more events, and thus preventing us from
earning
any money, causing my boss to bug me about fixing it, causing me to post
here
where we are supposedly getting a response from Microsoft within 48 hours.

When this first started occuring I assumed it to be file permission
problem
on the new server, but I went ahead and gave the Network Service account
full
control over the imageUpload directory, which is under the website. Does
anyone have any opinions about this? Should Network Service have such
privilege, is having the directory under the website causing IIS to become
adversely involved in this somehow?

Since I thought it also might be that file upload control itseltf or the
resizing events were not releasing their references or holds or whatever
on
these files, I went back and wrote a boatload of things like

Finally
rawBitmap = Nothing
resizedBitmap = Nothing
postedFile = Nothing

But then since every file gets renamed to the eventId + extension...Its
probably superfluous?

Then I think, what else could it be? It has te be an image stuck
downstream
in a client or proxy cache? Isnt that what a cache does, prevents grabbing
a
new version of something, and since the old image was username+extension
and
the new image is also called username+extension is ist simply not getting
the
latest image and so our clients look at the event preview and even though
their image was uploaded (?) they see the old image and freak out?

If this is the case, a MS engineer would probably say something like, ah
ha
see, not a bug or problem in VS, but a problem somewhere else, case
closed.
And yet I wrote an application that doesn't work for some users in some
situations and I need to fix it. If this is indeed what is happening (I
have
no idea really) is there a better way to engineer the application such
that
this will not happen to any users?

"Pitcairnia" wrote:
The basic purpose of the site is for authenticated users to post event
listings, which often include photographs. The user is faced with a page
where they can insert all of the information about the event in a typical
form with textboxes, drop down lists, etc. On this page there are also 4
file upload controls where the user can select 0 to 4 images on their
file
system for inclusion in the event listing. On submit, the images (if
any)
are uploaded to the server and named based on the user id and picture
number,
eg. 123456_01.jpg, 123456_02.jpg, etc. The user is shown a preview of
the
event with the images. On submit the event is inserted in the database
with
a return value of the pk or EventID number. This number is used to
rename
the images, eg. 123456_01.jpg becomes 9876_01.jpg, 123456_02.jpg becomes
9876_02.jpg.

This generally works very well. The image upload directory is directly
under the root of the website and has full control for ASP.Net, Network
Service, Everyone. this is IIS6 on Server 2003. However, a very small
portion of our users report that when they go to upload more than one
event,
when the preview shows up for the second event, the photos from the first
event show up. We also get reports that if they "shut down the computer
and
reopen it" between each listing it works ok. This is not acceptable
since we
get paid by the listing. I have requested of some users that they clear
their browser cache, delete all temporary files and cookies, and try
again
but these users report that it still occurs.

Is this a file upload permissions problem, or is it somehow that images
are
being cached somewhere since the name of the images on the preview page
is
the same (username + image number + .jpg)?

If this is a caching problem is there some way to make sure that images
are
not cached anywhere? What tags, if any can be used on the pages, or
settings
in iis?

Nov 19 '05 #3
Thank you Kevin, this works precisely as described, very low overhead simply
generating a random number. Thanks for your help.

We are not happy that this problem exists, however. We set up caching
wherever we need it and we do not expect anything to be cached elsewhere.

We instruct our clients to change their browser settings to check for a new
version of the page with every request but that setting does not affect
images, i presume.

What about an application that generates images using system.drawing and the
like and it is always returned the same way as in an aspx

<img src="captcha.aspx">

There needs to be a meta tag for this and browsers including and especially
Internet Explorer need to respect the tag.

Just my two cents while I have a soapbox.
"Kevin Spencer" wrote:
Add a QueryString with a random number to the image URL (e.g.
"/images/12345.jpg?n=520"). This will fool the browser into thinking that it
is not the same image, and it will request it from the server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Pitcairnia" <Pi********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Would like help on this issue as the 48 hr response time has elapsed, so
let
me further elaborate.

Because the image is always temporarily saved as the userId + extension
then
for every event the image will have the same name as the previous event
and
the one before that etc., but only when the event is saved is and eventId
generated, and so the image is then renamed to eventId + extension. User
then goes to add another event, uploads his description and pic, and then
there is the previous picture and not the one he just uploaded, preventing
the user from uploading any more events, and thus preventing us from
earning
any money, causing my boss to bug me about fixing it, causing me to post
here
where we are supposedly getting a response from Microsoft within 48 hours.

When this first started occuring I assumed it to be file permission
problem
on the new server, but I went ahead and gave the Network Service account
full
control over the imageUpload directory, which is under the website. Does
anyone have any opinions about this? Should Network Service have such
privilege, is having the directory under the website causing IIS to become
adversely involved in this somehow?

Since I thought it also might be that file upload control itseltf or the
resizing events were not releasing their references or holds or whatever
on
these files, I went back and wrote a boatload of things like

Finally
rawBitmap = Nothing
resizedBitmap = Nothing
postedFile = Nothing

But then since every file gets renamed to the eventId + extension...Its
probably superfluous?

Then I think, what else could it be? It has te be an image stuck
downstream
in a client or proxy cache? Isnt that what a cache does, prevents grabbing
a
new version of something, and since the old image was username+extension
and
the new image is also called username+extension is ist simply not getting
the
latest image and so our clients look at the event preview and even though
their image was uploaded (?) they see the old image and freak out?

If this is the case, a MS engineer would probably say something like, ah
ha
see, not a bug or problem in VS, but a problem somewhere else, case
closed.
And yet I wrote an application that doesn't work for some users in some
situations and I need to fix it. If this is indeed what is happening (I
have
no idea really) is there a better way to engineer the application such
that
this will not happen to any users?

"Pitcairnia" wrote:
The basic purpose of the site is for authenticated users to post event
listings, which often include photographs. The user is faced with a page
where they can insert all of the information about the event in a typical
form with textboxes, drop down lists, etc. On this page there are also 4
file upload controls where the user can select 0 to 4 images on their
file
system for inclusion in the event listing. On submit, the images (if
any)
are uploaded to the server and named based on the user id and picture
number,
eg. 123456_01.jpg, 123456_02.jpg, etc. The user is shown a preview of
the
event with the images. On submit the event is inserted in the database
with
a return value of the pk or EventID number. This number is used to
rename
the images, eg. 123456_01.jpg becomes 9876_01.jpg, 123456_02.jpg becomes
9876_02.jpg.

This generally works very well. The image upload directory is directly
under the root of the website and has full control for ASP.Net, Network
Service, Everyone. this is IIS6 on Server 2003. However, a very small
portion of our users report that when they go to upload more than one
event,
when the preview shows up for the second event, the photos from the first
event show up. We also get reports that if they "shut down the computer
and
reopen it" between each listing it works ok. This is not acceptable
since we
get paid by the listing. I have requested of some users that they clear
their browser cache, delete all temporary files and cookies, and try
again
but these users report that it still occurs.

Is this a file upload permissions problem, or is it somehow that images
are
being cached somewhere since the name of the images on the preview page
is
the same (username + image number + .jpg)?

If this is a caching problem is there some way to make sure that images
are
not cached anywhere? What tags, if any can be used on the pages, or
settings
in iis?


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
4
by: Eric | last post by:
Hi, can anyone guide me throught this: In my application, I have a global DataSet. I then run FTP processes in up to 10 simultaneous threads and each thread calls progress events in the main...
4
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY...
3
by: Viktor | last post by:
Hi all, I'm trying to host my web application which is wriiten in ASP.NET/C#/SQL on webhostingcenter.com. They use H-SPHERE control panel. I have written my application on my PC, so the SQL...
1
by: theburnetts | last post by:
I am building an ASP.NET application that has a requirement that the user should be able to download all of the data that they have input into the system and save it to a file on their local PC. ...
2
by: suresh_nsnguys | last post by:
Hi, I am working in digital signage application where user can upload image,flash and movie files .and later thay can view the uploaded files in digital LCD screen. I am facing 1...
0
by: phpfreak2007 | last post by:
Hi all, I am trying to upload file using VB HTTP Post method and winsock control . Can successfully upload the files when client machine is English OS, but create problem when upload from Chinese...
11
by: agarwalsrushti | last post by:
Hi, Ive created a registration page in which at the last it asks the user to upload the resume file. When the user clicks on the upload button to upload the file it automativcally submits all the...
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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...

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.