4

I get that regular ASP finagles statefullness using viewstate, but MVC doesn't try to perpetuate the bold-faced lie of statefulness. So how is it able to maintain sessions?

5
  • 4
    A cookie contains the session ID. Commented May 11, 2013 at 15:42
  • Ah, so if cookies are disabled, then there is no session. Is it possible to spoof a cookie? Commented May 11, 2013 at 15:44
  • Yes, you can spoof nearly anything Commented May 11, 2013 at 15:46
  • 1
    @sircodesalot The client can manipulate the cookie as it likes. But if the server does implement sessions correctly, then guessing a valid session id is practically impossible. I don't know how ASP.net does it, but a popular mechanism is generating a random 128 bit value as session ID. Commented May 11, 2013 at 15:49
  • Maintaining state and session are 2 different things. ASP.NET and ASP.NET MVC can handle SessionState. ASP.NET has ViewState for statefull pages. Commented May 11, 2013 at 19:48

2 Answers 2

7

By default it stores a randomly generated number in a cookie and stores that in memory. If the browser says it doesn't support cookies, asp.net will then instead add the session key in the url, it will show up like http://myurl.com/(S(rpfa4y3c5oe2c555ljanprek))/Controller/Action

Sign up to request clarification or add additional context in comments.

Comments

1

It is using a Session ID to identify a user, stored in Cookies. Spoofing is possible if your know the victim's ID, and if other security measurements won't interfere (e.g IP based authentication).

4 Comments

you also can use a fake IP in some circumstances
Wow, I'm familiar with desktop programming, but I'm fairly new to web development. Sounds like web security is fairly complex. Any resources I can turn to to learn more?
@sircodesalot: the OWASP Top 10 Project is probably you're best starting point
@sircodesalot actually, not really. It's all about sanitizing input, just like in every server based programming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.