I have my webUpload control set up in a webForm. It works to the extend that it uploads a file and saves it in my 'Uploads' directory. But the problem is that I need the session available from HttpContext.Current.Session to be able do what I want with the file. It is evaluating as null and I don't understand why.
Hello chadc,
I have opened a support ticket on your behalf. This is the case number CAS-84803-P697X8. We will continue our communication regarding this through the support ticket. Thank you for using our community.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Hi Georgi,
Has this issue been resolved yet? I am running into the same issue with needing to access the HttpContext.Current.Session as well.
They were able to duplicate this issue, that's why they opened the support ticket. I assume they will post on this thread when the fix is available.
My workaround is to let the upload save the file in the upload directory and I rename it in the server-side uploadfinished event, then on the clientside onuploadFinished event, I perform a click event on a hidden button to initiate postback that will process the file. Since I'm renaming the file to ensure that it is unique, I create a cookie (suggested by support) with the file name to attach to the response. This cookie is then available on the postback and that's how I know what file to use. This works for now, but I am very disappointed in the implementation.
This is what I would hope for:
1) The upload control is configurable for one single directory to receive uploads. It should at least allow you to change the directory per control.
2) I'd actually prefer it didn't write my file to a directory, I wish I could handle the upload event and just get the bytes that were uploaded so that I could just take the file in memory and process it as I desire.
3) Once the bug is fixed and I have access to the session and I can process the file on the upload event handler, it would be nice to be able to return a serializable object in a JSON format back to the client so that I can provide information back to my user. Because even if I can process the file as soon as it uploads, the way it is designed, it seems I'm always forced to make another request to get the messages that are needed to display the results of the operation.
Hey chadc,
I can propose you workaround to use session in server side events you can just set in Page_Load var session = this.Page.Session. Please try this. Here are my comments for your proposals.
1) The main idea for upload directory is to have only ONE temporary folder where files are saved and then using server side events to save them anywhere you want or to do with the files what you want. But we have discussed this and we think to implement each control to be configurable to have separate folder. I hope we will implement this for the next Service Release.
2) We plan to implement saving files in memory stream(or byte array) for the next SR.
3) As I said one workaround is to play with your session in page_load. For instance to set var session = this.Page.Session in your Page_Load event handler.
Thanks,
Miro Hristov
That is not going to work. The reason there is no session state available is that the upload controls events are raised from an object that implements IHttpModule. Session is not available in an HttpModule.
Hello Lenny,
Did you have a chance to try this. We tested it on our end and it works in all the cases.
Looking forward to hear from you.
My mistake the session is available as Session[key] but not available here:
HttpContext.Current.Session
Sorry for any confusion.
Hey Lenny,
It is normal that HttpContext.Current.Session is not available because HttpContext always relates to the current request.
HttpContext