Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make session readonly on asp.net programmatically (EnableSessionState="ReadOnly")

Tags:

asp.net

I need to make the session readonly so I can establish multiple requests to a page that uses sessions variables but in the readonly mode.

Since all the process are performed on my server control I need a way to make the session readonly programmatically.

like image 968
EBAG Avatar asked Dec 22 '10 04:12

EBAG


1 Answers

If you use ASP.NET MVC, you can use the SessionStateAttribute class on the controller level.

[SessionState(SessionStateBehavior.ReadOnly)]

If you want to control the behavior on an action level, you can use this:

https://www.c-sharpcorner.com/UploadFile/ff2f08/session-state-behavior-per-action-in-Asp-Net-mvc/

If you use ASP.NET Web Forms, I am not quite sure, but it should be something along these lines...

like image 169
user2173353 Avatar answered Nov 15 '22 07:11

user2173353