Generating a new ASP.NET session in the current HTTPContext

前端 未结 6 1342
终归单人心
终归单人心 2020-11-27 03:29

As a result of a penetration test against some of our products in the pipeline, what looked to be at the time an \'easy\' problem to fix is turning out to be a toughy.

6条回答
  •  难免孤独
    2020-11-27 03:41

    Have you considered using the HttpSessionState.Abandon method? That ought to clear everything. Then start a new session and populate it with all the items you stored from your code above.

    Session.Abandon(); should suffice. Otherwise you could try to go the extra mile with a few more calls if it's still being stubborn:

    Session.Contents.Abandon();
    Session.Contents.RemoveAll(); 
    

提交回复
热议问题