Please share your opinion with me.

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

I am sorry for posting this message again. But I really want to hear more
responses.

---
My company is designing a new ASP.Net web application. Becasuse of the
concern of abusing Session variable(will consume memory), our team is going
to use following apporach to avoid it. Some of team members think it is
unnecessary and don't agree with this approach. I would like to hear your
oppinion about this. Or if you use any of process to limit the developers
using session variables in the ASP web application. Thank you in advance.
Following is our proposal process.
1. Add the session variable names to the webconfig file. Only one person in
the team( 7 developers) is allowed to add it. So if other developers in the
team need to add new session variable, they need to ask that person to add
it in the Webconfig file first.
2. Create a wrapper class for getting and setting the session variable
values. This wrapper class will check if the session variable exists in the
webconfig file. If not, error returns. Developers ,instead of calling
Session object directly, will call the wrapper class method.

Regard

Jerry
 
Consider what happens in the future when you get another developer. You
will have to train him or her to talk the person responsible for adding
session variables.
 
Thanks Marina, Natty, Roy for your responses.
In order for me to persuade my application architects to give up this
process, I would appreciate more application architects and developers'
thought about this process.
Thanks

Jerry
 
One more point : Every change in the web.config will end up with
restarting your application. So if you want to add new session variable
while the application running it will end up with restarting the
application and loosing all the current session state. If you choose to
take this root maybe its better to save the session variable
"declaration" in DB (this way there is one control over the variable
declaration) and to load it in the application cache to be use by the
program.

I understand the concern about memory usage but actually the problem
isn’t the number of session variables but the size of the variable. I
already see programmers that hold mega bytes of data (DataSet) in one
session variable. I don’t think that the suggested approach will help
your application architect to control the size of memory that the
session variables will take. all the projects that I involved in until
now just send small chunk of text in the Session and although they serve
600-800 RPS on machine with 2GB of RAM they never use more then 30% of
the RAM. If I have to look after solution to memory usage I would
Override the page session property and check the size of the data that
the programmer is going to save on the disk (Serialization for objects
:-( ) and decide if I save it on the disk or on Remote machine or DB.

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Hi,
well using the session object whenever required / storing the appropriate values is ok, but restricting the developers by just defining the rule of readding the session variable name from the Web.Config file will just add another over head of reading an external file first then reading/placing the values in session.

best thing to do is to access session directly without storing the names in web.config file and as add a coding standard to project development as adding any new session variables should be... approved.
you can also have peer reviews on the code

and u can anytime easily check the values in session by simple writing the peice of code
for (int 1=0; i<Session.Count; i++)
{
Response.Write("<BR>Key : " + Session.Keys + " Value : " + Session.ToString());
}

Rajeev
 
Back
Top