Changing Session State programatically

M

Maximus

Hi everybody,

Has anyone changed the session state in web.config programatically
through the applications. Any Help will be appreciated.

Thanks.
 
M

Marina

You can load up web.config into an XML dom, manipulate it, and save it back.
This will however restart the application, and all current sessions will be
dropped.
 
K

Kevin Spencer

If you make any changes to the web.config file and save it while the app is
running, the app will restart, losing any Application and/or Session data
that currently exists.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

Maximus

Kevin said:
If you make any changes to the web.config file and save it while the app is
running, the app will restart, losing any Application and/or Session data
that currently exists.
Hi Kevin,

Thanks a lot for the the help. I am aware of it and will still like t do
it as my application would not have a problem with it. So if you could
help me I'll appreciate it.

Thanks.
 
M

Maximus

Marina said:
You can load up web.config into an XML dom, manipulate it, and save it back.
This will however restart the application, and all current sessions will be
dropped.
Hi Marina,

I am aware of the application restarting. I do not ahve a problem with
it. What I thought was there was a .net class like ConfigurationSetting
which I can use to load the session state like
Configuration.GetConfig("system.web/sessionState") and then manipulate
it and save it. I was not sure how to do that. Was wondering if you
could helo me.

Thanks.
 
K

Kevin Spencer

Well, it's a text file. Just open, parse, and change it, then save it back.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

Marina

Yes, I did tell you how to do it. Load it up into an xml dom, change it, and
save it back.

The configuration classes are meant for read only access. You are not really
supposed to change it from the application itself, so no such methods were
provided.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top