I hesitated before writing this question, as it sounds like I'm after an opinion without trying anything yet. That's not the case, I just don't want to go down the wrong route with architecture - it needs planning well in advance and I don't want to fall victim to the XY problem.

I have a web-app. It's a 'thin' HTML and javascript client, making AJAX requests to my asp .net MVC solution. All's well, but I need to add offline capability to this app by making use of localstorage and the HTML5 application cache, which means I'm going to provide the form, and let the user submit it if they have a connection. If they do, and it posts to the server - at what point do I authenticate? How do I authenticate if it's just a HTTP post request?

I'm pretty new to MVC, I understand WebForms carried a lot of 'behind the scenes' stuff in the view state, some of which may have been used for authentication? But I don't know how I can pass authentication data to an MVC controller. More importantly, I don't know if I'm approaching these requirements right. Should I have a separate 'offline' form that will never even attempt to send off the data to the server and send it later on from a different section? Or is it common to check if a user is authenticated or not from their AJAX request?

  • 1
    I tried "aggressively editing" your question title to something more descriptive which I think gets at the heart of your question, and should be a bit more appealing to potential answerers. If I guessed wrong feel free to revert the change. – Ixrec Jun 8 '15 at 19:12
  • @Ixrec Nope, spot on. Thanks. – JᴀʏMᴇᴇ Jun 8 '15 at 19:17

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.