tags:

views:

36

answers:

1

Hello, we have a vb.net application with send and receive mailing also. Now we have added a session timer of 30 min but the users are complaining that they are facing a problem when they write a long text message or while composing they get busy in something else and when they return back to continue composing message , they are redirected to a session expiry page, and their long text message is gone forever. So I am new to this and I was thinking like , when the user is in compose message the text should be automatically saved to drafts like hotmail. Any help will be appreciated . Thank you.

+1  A: 

There are two basic approaches you can take to this:

  1. The proper "web" way would be to remove the need for session and state from at least this part of the application i.e. set up the application so that its resilient if the session expires and can pick up the necessary user details etc from the post if the session has expired - you can do this with a value stored in viewstate or in a cookie. However this doesn't deal with the problem of saving work in progress.
  2. So the more appropriate solution here will be to investigate AJAX solutions to the problem whereby the page uses client side scripting to transparently "save" (post) the message text back to the server at defined intervals. This has the further advantage of prolonging the session as well.

Of course with the AJAX solution your back end data management becomes more complex too... but it that's manageable (limit it to one draft in progress and remember to clear out the draft on "send" and you should be fine) and you may still want to consider some degree of additional resiliency for loss of session for other reasons.

Murph
Thank you but we are not using ajax now ?
ahmed
All ajax is is javascript and something akin to a web service call - in all other respects you leave your app exactly as it is, you just need to do this one extra thing - which is to send the text back to an appropriate method in your code-behind (I'm rashly assuming asp.net webforms at this point). Further the Microsoft Ajax tools will probably go some distance to actually doing the heavy lifting for you. Focus on the simple problem - sending the data from the client and saving it.
Murph
Ok so shall I save the data in a table periodically...ie every min or two ???
ahmed
can you tell me how is Hotmail doing this ? when we compose a new message it shows " your message has been saved to draft " and the counter raises to 1 in draft folder. Now something weird happens for instance disconnection , or something crashes , the text is saved as draft ..this is awesome. I want same like that.
ahmed
Hmm, this needs an example and that requires time and that I don't have (or at least that I'm failing to organise). I can't tell you exactly how hotmail or google achieve the effect other than as above, they have javascript making calls to the server as you type to a) save the data and b) refresh part of the page (in MS ajax you might use an updatepanel). You need to start with a new project to work this out, just a textbox that autosaves every 10s if changed.
Murph
Thank you so much for your help and advice. I will try that for sure.
ahmed