473,382 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

SessionState - HELP

Hi,
Could anyone please let me know how to read SessionState setting from the
Web.Config file into an ASPNET application?

TIA
Krishnan
Nov 19 '05 #1
7 1490
Krishnan wrote:
Hi,
Could anyone please let me know how to read SessionState setting from
the Web.Config file into an ASPNET application?

TIA
Krishnan


What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting
Nov 19 '05 #2
Thanks for your reply.

Am trying to seee if the session state is "InProc", for we need to take some
Serialization decisions based on them. Session.Mode would need
HttpContext.Current and we need to read the settings even in the destructor
(finalize) methods of some classes and they'd not have the HttpContext. So,
is there a way to read the Config without the current HttpContext?

TIA
Krishnan

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
Krishnan wrote:
Hi,
Could anyone please let me know how to read SessionState setting from
the Web.Config file into an ASPNET application?

TIA
Krishnan


What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting

Nov 19 '05 #3
Hi, Krishnan.

You don't have to read web.config to get the Session Mode.

You can read the current Session State Mode with

Page.Session.Mode

GetSessionMode.aspx:
--------------------------
<%@ Page Language="VB" %>
<script runat="server">
sub Page_Load(obj as object, e as eventargs)
lblMessage.Text = Page.Session.Mode.ToString()
End Sub
</script>
<html>
<body>
<asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
</body>
</html>
------------------------

HTH...

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Krishnan" <kr*********************@myrealbox.com> wrote in message
news:eB**************@TK2MSFTNGP14.phx.gbl...
Thanks for your reply.

Am trying to seee if the session state is "InProc", for we need to take some
Serialization decisions based on them. Session.Mode would need HttpContext.Current and
we need to read the settings even in the destructor (finalize) methods of some classes
and they'd not have the HttpContext. So, is there a way to read the Config without the
current HttpContext?

TIA
Krishnan

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
Krishnan wrote:
Hi,
Could anyone please let me know how to read SessionState setting from
the Web.Config file into an ASPNET application?

TIA
Krishnan


What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting


Nov 19 '05 #4
Thanks for that, but as I had said in my post, there are situations when I
will not have the HttpContext. So, is there a way to still get the
SessionState?

Thanks
Krishnan

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uz**************@TK2MSFTNGP15.phx.gbl...
Hi, Krishnan.

You don't have to read web.config to get the Session Mode.

You can read the current Session State Mode with

Page.Session.Mode

GetSessionMode.aspx:
--------------------------
<%@ Page Language="VB" %>
<script runat="server">
sub Page_Load(obj as object, e as eventargs)
lblMessage.Text = Page.Session.Mode.ToString()
End Sub
</script>
<html>
<body>
<asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
</body>
</html>
------------------------

HTH...

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Krishnan" <kr*********************@myrealbox.com> wrote in message
news:eB**************@TK2MSFTNGP14.phx.gbl...
Thanks for your reply.

Am trying to seee if the session state is "InProc", for we need to take
some Serialization decisions based on them. Session.Mode would need
HttpContext.Current and we need to read the settings even in the
destructor (finalize) methods of some classes and they'd not have the
HttpContext. So, is there a way to read the Config without the current
HttpContext?

TIA
Krishnan

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
Krishnan wrote:
Hi,
Could anyone please let me know how to read SessionState setting from
the Web.Config file into an ASPNET application?

TIA
Krishnan

What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting



Nov 19 '05 #5
I don't think that you can get to the Session mode
without going through the httpContext.

Could you, maybe, retrieve the sessionState mode at any earlier point
where you *do* have access to the httpContext, and save the returned
sessionState mode to a variable which you would be able to retrieve
when you don't have access to the context ?


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Krishnan" <kr*********************@myrealbox.com> wrote in message
news:O8**************@TK2MSFTNGP14.phx.gbl...
Thanks for that, but as I had said in my post, there are situations when I will not have
the HttpContext. So, is there a way to still get the SessionState?

Thanks
Krishnan

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uz**************@TK2MSFTNGP15.phx.gbl...
Hi, Krishnan.

You don't have to read web.config to get the Session Mode.

You can read the current Session State Mode with

Page.Session.Mode

GetSessionMode.aspx:
--------------------------
<%@ Page Language="VB" %>
<script runat="server">
sub Page_Load(obj as object, e as eventargs)
lblMessage.Text = Page.Session.Mode.ToString()
End Sub
</script>
<html>
<body>
<asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
</body>
</html>
------------------------

HTH...

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Krishnan" <kr*********************@myrealbox.com> wrote in message
news:eB**************@TK2MSFTNGP14.phx.gbl...
Thanks for your reply.

Am trying to seee if the session state is "InProc", for we need to take some
Serialization decisions based on them. Session.Mode would need HttpContext.Current and
we need to read the settings even in the destructor (finalize) methods of some classes
and they'd not have the HttpContext. So, is there a way to read the Config without the
current HttpContext?

TIA
Krishnan

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
Krishnan wrote:
> Hi,
> Could anyone please let me know how to read SessionState setting from
> the Web.Config file into an ASPNET application?
>
> TIA
> Krishnan

What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting



Nov 19 '05 #6
Krishnan wrote:
Thanks for your reply.

Am trying to seee if the session state is "InProc", for we need to
take some Serialization decisions based on them. Session.Mode would
need HttpContext.Current and we need to read the settings even in the
destructor (finalize) methods of some classes and they'd not have the
HttpContext. So, is there a way to read the Config without the
current HttpContext?
TIA
Krishnan

As a last resort: the web.config *is* just an xml file, so you could
read in the file and get at the setting yourself. That is, if you just use
*one* web.config ...

Just curious: why would you want to know about the Session.Mode if
you can't access the Session itself at that point?

Hans Kesting
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
Krishnan wrote:
Hi,
Could anyone please let me know how to read SessionState setting
from the Web.Config file into an ASPNET application?

TIA
Krishnan


What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting

Nov 19 '05 #7
Thanks for the reply. We resorted to storing the Session Mode in the class.

We need it since we store a com object "as is" into a session case of an
InProc session mode and the same cannot be destroyed in the destructor of
the class (destructor gives no HttpContext as it is a CLR call), but in case
of a StateServer, since the object is serialized, it can be released.

Thanks again.
Krishnan

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Krishnan wrote:
Thanks for your reply.

Am trying to seee if the session state is "InProc", for we need to
take some Serialization decisions based on them. Session.Mode would
need HttpContext.Current and we need to read the settings even in the
destructor (finalize) methods of some classes and they'd not have the
HttpContext. So, is there a way to read the Config without the
current HttpContext?
TIA
Krishnan


As a last resort: the web.config *is* just an xml file, so you could
read in the file and get at the setting yourself. That is, if you just use
*one* web.config ...

Just curious: why would you want to know about the Session.Mode if
you can't access the Session itself at that point?

Hans Kesting
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
Krishnan wrote:
Hi,
Could anyone please let me know how to read SessionState setting
from the Web.Config file into an ASPNET application?

TIA
Krishnan

What exactly are you trying to do?
You can access some of the values with Session.IsCookieless
and Session.Mode

Hans Kesting


Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TSelvan | last post by:
Hi All, We have developmented Web project with ASP.Net and SQL server Database. In this project we have configured "SessionState" mode as "SQLServer" in Web.Config with timeout="180" as...
0
by: Flemming Jensen | last post by:
The idea behind this code is to standardize all my webpages in an application to look the same by inheriting the pages from a userdefined class. But it gives me problems regarding sessionstate... ...
3
by: Kenny | last post by:
Hi , I have created two Web Application - WebApplication1 and WebApplication2 in same machine for testing purpose. e.g http://localhost/WebApplication1.aspx...
5
by: Mikko Penkkimäki | last post by:
Hi Looks like I can not change Web page's timeout setting. In practise it's all the time 20 minutes - no matter what I do. I have this kind of setting in web.config: <sessionState...
4
by: jensen bredal | last post by:
Hello, i was not able to find any documentation about the largest value one can assign the "timeout" attribute of the <sessionState section in web.config. any idea?
2
by: Philipp Schumann | last post by:
....BUT for _custom_ HttpHandlers. How can I do that? In my custom IHttpHandler, HttpContext.Current.Session is a null reference, and I can't use the session state. It is enabled in web.config...
2
by: spgmbl | last post by:
I have set up the local environment to use sqlserver mode testing. The article i followed to install was here: http://support.microsoft.com/default.aspx?scid=kb;en-us;317604 I also changed the...
0
by: =?Utf-8?B?RmFiaWFuIEFuZGVyc29u?= | last post by:
Hi WS Developers, I have am working on an integration project in which we are using WSDL and MS XML WebServices to integrate legacy systems other with external systems. Unfortunately, we must...
0
by: somnathmali | last post by:
Suppose I have site xyz.com. Site has a page called show_user.aspx where I need to access the Session variables. But this show_user.aspx page will not be called directly Instead , when user type...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.