Hello Brettle and others,
I think it's fair enough to call myself a novice for as far webdevelopment goes ( and for many other things, but let's stick to the topic...).
With that said, i would like to ask for some help with the following:
I'm trying to implement this nice file upload control you provide, but i have diffelculties with all my session variables, that i was happily using all over my (master) pages.
I understand the fact that i have to set the EnableViewState attribute to false on my upload page, so the progress-bar can do its job.
But because i use session variables on my master page, this is not enough.
Now, i can think of ways to store this "session" data in other places, but before i start rebuilding a lot of pages, it would be of great value to hear how others have salved this problem. You must have come across this, or not??
The query string is not really an option because it involves information that you do not want visible, or easily altered.
I hope somebody finds the time to help me with this. Even though, of course, it's not a problem of the file upload but just a leg of knowledge.
Greeting and thanks in advance,
I assume when you said EnableViewState="false", you meant EnableSessionState="false". Correct? You only need to do that if you want to show processing progress in addition to regular upload progress. Are you actually trying to do that? Try using EnableSessionState="true" and see if it works like you want.
Hello Dean, and thanks for you reply
Yes, i meant EnableSessionState="false". I coyed the wrong one from my screen.
I'm using version 1.3.13.
Because of my use of session variables, i am now using an extra iframe on the page that contains the fileupload. On this, i pass my session variables to a temp cookie, so the upload page, inside the iframe, can access this information.
So the page containing the iframe has EnableSessionState="true" and the uploadpage ( the sourcepage of the iframe, with the upload controle) has EnableSessionState="false"
Is this a reasonable solution. Or did i just make you laugh?
My concern is that you are making things more complicated than they need to be. Do you need to show processing progress or just upload progress? In other words, are you doing any processing in your submit handler that would cause a user-visible delay?
After uploading the file, which is a kind of zip archive of a third party application, I'll start extracting the content, applying a xslt template, checking xml content for valid data against a database, and then converting a bunch of images varying from 20 up to 150+. ( all is this archive)
This whole process can take up to 20 seconds, depending on the size of the package. plenty of time to entertain the user with some "what's going on" information.
With my iframe solution i have it working, and manage to inform the user about the steps being taken and how far we are in the process.
The question for remains though, What is the suitable solution to bypass the use of session variables on this on page, that also uses a master page.
Ones again i hope the question is not considered a stupid one.
Thanks for the clarification. There is no single correct approach to the problem of disabling session state on a page that uses a master page that requires session state. It really depends on your requirements. Your approach of sending the relevant session state in a cookie to an iframe might be fine.
When considering options, keep in mind that there are 2 separate problems you are trying to solve. The first is allowing the page displayed to the user to have EnableSessionState=true so that it can use a master page which requires session state. The options I can think of for that are:
1. Use an iframe to display a simplified page with EnableSessionState=false, like you are doing. 2. Do a cross-page postback to a handler or page with EnableSessionState=false, that does the work and then redirects to a page with EnableSessionState=true. This might provide a better look than using an iframe.
The second problem is accessing the session state you need while doing your processing. Options include:
1. Pass the relevant session state in cookies, hidden form fields, or the query string. The primary disadvantage to this approach is that your server-side code has no way of knowing whether the values passed are actually from a valid non-expired user session. If that is a concern, you would need to have the server timestamp and sign the serialized session state before putting it in one of the aforementioned locations, and then verify the signature/timestamp before using it. 2. Use NeatUpload's SimpleWebRemoting class to call from your processing code to a separate page/handler (that can have EnableSessionState=true) to get the relevant session state. See SessionBasedUploadStateProvider.cs and UploadStateStoreHandler.cs to see how NeatUpload uses SimpleWebRemoting internally to maintain upload state in the session without locking it. The key advantage that SimpleWebRemoting has over using some other remote method call mechanism is that SimpleWebRemoting uses the cookies (and URL-based session id if you use cookieless sessions) from the current request when it makes the child request, so when you process the child request you can access the session.
I never used a cross page post-back, but i understand the concept.
Thanks for pointing me in the right direction Dean. At least i know now were to look to solve my problem.
Your help is really appreciated!