MVC2 Cookieless Session Issue using POST

后端 未结 3 2016
不思量自难忘°
不思量自难忘° 2020-12-10 09:35

For some reason with cookieless session enabled in MVC2, the session id in the query string is reset with every form post that happens. Is there a special route that needs t

3条回答
  •  [愿得一人]
    2020-12-10 10:01

    Cookieless sessions do work in MVC2, however, you cannot use POST as the method for the form submit. It only supports the use of GET. Also, all of the action paths on the forms need to be updated to the following pattern:

    " method="get">

    That will ensure that the session id is automatically passed along. This is the line needed in the web.config file to enable cookieless sessions:

    
        
    
    

    With those two above changes, everything worked!

    If you are interested in a workaround for getting POST to work with Cookieless session and MCV2, I found the following page. Enabling POST in Cookieless ASP.NET This wasn't well suited for my project because I am not able to use JavaScript.

提交回复
热议问题