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? | | | | re: Problem in ASP.Net File Upload Application
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:
[color=blue]
> 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?[/color] | | | | re: Problem in ASP.Net File Upload Application
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" <Pitcairnia@discussions.microsoft.com> wrote in message
news:B69C4B8E-C571-41B2-90D2-649D27E1BE83@microsoft.com...[color=blue]
> 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:
>[color=green]
>> 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?[/color][/color] | | | | re: Problem in ASP.Net File Upload Application
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:
[color=blue]
> 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" <Pitcairnia@discussions.microsoft.com> wrote in message
> news:B69C4B8E-C571-41B2-90D2-649D27E1BE83@microsoft.com...[color=green]
> > 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:
> >[color=darkred]
> >> 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?[/color][/color]
>
>
>[/color] |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|