I put that second line in my session_start as you advised that says:
Session("myDBProc") = myDBProc
and I still get exactly the same error. Since I have seen this problem
posted before and also noticed than noone has been able to find a solution,
I suspect that maybe this is a bug in asp.net?
Trying something simpler I put the following into session_start:
dim sessioninteger as integer = 4
and tried to retrieve it from my aspx page - it came through as zero
Then,
I used your suggestion to follow that definition with:
session("sessioninteger") = sessioninteger
and it came through as 4, as it should.
(by the way, i don't see your suggestion in any docs or books - is this an
undocumented solution?)
so, it seems that it will work with simple value types but not with
something more complex.
Not sure I know where to go from here,
Dean
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
Even in the global.asax you still need to place the connection into the
session variable.
Change your code to include setting the session variable and it will work:
Now I have the instantiation in global.asax in the session_start:
dim myDBProc as PhotoDBProcs = new PhotoDBProcs(...connection string )
Session("myDBProc") = myDBProc
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Dean" <de*********@earthlink.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... I have notice a couple of other threads here that depict the same
problem I am having: I can't get session state to work.
I wrote a component class to do all of my database access and use it in
both Windows .net and ASP.net applications. I was dealing with it in a
single aspx page (using codebehind) where it worked fine for this particular
app.
Now I have the instantiation in global.asax in the session_start:
dim myDBProc as PhotoDBProcs = new PhotoDBProcs(...connection
ring )
In one of the pages that uses this I have:
dim myDBProc = ctype(Session("myDBProc"), PhotoDBProcs)
But this gets flagged with an error saying that session state can only
be used when enablesessionstate is set to true. I do have it set to true
on this page as follows:
<%@ Page Language="vb" EnableSessionState="true" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="DBAPhotoQuery.WebForm1"%>
Also my web.config file says:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
Any idea why this is not working
thanks,
Dean