0

we have a strange problem, probably you can give me a Hint, because I've never seen something like this. We're using a WebApplication, where the Users log in with WIF. The problem looks like this:

  1. User 1 uploads File1 with a self-created Upload-Control --> Works
  2. User 2 uploads File2 with the same Control --> Upload fails after the File is uploaded, File2 stays in the Upload-Folder
  3. User 3 uploads File3, but the UploadControl uses the Filename of User 2 --> Ooops

This means user 3 uploads File2, since this is still in the Upload-Folder and anyhow, the user3-Session knows the Filename of User 2.

My question: How is this possible: It seems like each user has his Unique Session ID, and as far as I know the HTTPContext lives only for the Request-Time, and we get the FileName from there.

It seems like this problem wasn't there since the beginning of the Control-usage, so I guess there is a Environment-change?

Thanks in advance

Edit: I did as Kununk said and use Sessions instead of Applications, but it seems like on some HttpContext.Current.Session is null.

I checked the What should I do if the current ASP.NET session is null? and implemented IRequiresSessionState on our IHttpHandler, but it does not work still. Furthermore I implemented the AcquireRequestState-Event and this is called for sure.

Is there any other possibility why the Session is null?

Community
  • 1
  • 1
Matthias Müller
  • 3,336
  • 3
  • 33
  • 65
  • 1
    with code samples I could help more :) I would speculate on usage of static fields in the classes for settings stuff in the upload control, but that's just guessing due to limited information. – Kunukn May 13 '14 at 08:00
  • It's really hard to show code, since this UploadControl is quite big and the Code, which causes the problem is not ours. BUT: We have a Singleton Class, but this one reads the relevant Data of the Request as well: return HttpContext.Current.Application[STATUS_KEY + key] as UploadStatus; – Matthias Müller May 13 '14 at 08:42
  • what about HttpContext.Current.Session? Application is like a static class – Kunukn May 13 '14 at 08:55
  • So you say, if the STATUS_KEY + key would fit on x Users, they would get the same Data? Sadly I did not create the Control, is there a reason for Application over Session? – Matthias Müller May 13 '14 at 09:12
  • 1
    Application is per server, Session is per user. You should read this http://stackoverflow.com/questions/5096544/application-vs-session-vs-cache – Kunukn May 13 '14 at 09:21
  • Thank you sir, I guess this might be a good explenation – Matthias Müller May 13 '14 at 09:27

0 Answers0