asp.net - How actually Session works in MVC? -


i'm little-bit confused session management in mvc4.

lets say, entered username , password , clicked on login button. on server side, got sessionid httpcontext.current.session. , validating user credentials against database. if user valid, adding sessionid, username , uiserid in session.

lets say, next time request came same machine , same browser, got same sessionid , allowing user access other information.

now have following questions:

  1. how server come know request came same browser , same machine?
  2. i found that, sessionid different different browser same same browser on different machine, if logged in machine1 , google chrome, possible use same session different browser?(means session available different machine same browser. possible?)
  3. how server understand request same user, logged in?
  4. in asp.net session maintained viewstate, view state not used in mvc, used in mvc?

first suggest read this wikipedia article http sessions. answers on question:

  1. with every request client sends sessionid in either cookie or query string.
  2. this should not possible default. can done session hijacking.
  3. the server reads sessionid sent client in question 1. server maintains example key value data object can load right data given sessionid.
  4. asp mvc doesn't use viewstate since it's different approach asp.net. see this question more information.

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -