This is a better example:
In the Page Load event of the user conmtrol I have this code:
If Not Page.IsPostBack Then
lblUserName.Tex t = Session.Item("S ecurityInfo").U serFullName
lblUserRole.Tex t = Session.Item("S ecurityInfo").R ole
subFillProfessi onCombo()
RaiseEvent SecurityDetails Loaded()
End If
The user control is placed on 2 different forms. When I do a
Server.transfer to one form it works Ok, but when I do a Server.Transfer to
the other one I get the exception. I can't seen any obvioud differences
between the two forms.
Thanks
Siobhan
"Siobhan" wrote:
I realised this seemed to happen after doing Context.Items.C lear but it also
seems to happen on other occasions - for example these lines of code:
Context.Items(" strForm") = "Message"
Context.Items(" strMessage") = "Registrati on Cancelled"
Context.Items(" UpdateTree") = "True"
Server.Transfer ("frmMessage.as px")
In frmMessage there is a user control which reads information from a session
variable and this line of code falls over with the error:
If Session("Securi tyInfo") Is Nothing Then --FALLS OVER HERE
Response.Redire ct("Default.asp x")
End If
"Scott Allen" wrote:
This is from inside the processing of an ASPX page?
Do you know the exact line of code where the exception is thrown?
--
Scott
http://www.OdeToCode.com/blogs/scott/
I am getting the following error:
Run-time exception thrown : System.Web.Http Exception - Session state
can
only be used when enableSessionSt ate is set to true, either in a
configuration file or in the Page directive
Session state is enabled throughout the application.
This is occuring after I do a server.transfer and I am passing details
between my 2 pages using Context.Items collection. It would appear
theuse of the Context.Items collection is causing this problem as it
was not occurring when I used Response.Redire ct and a query string
Any ideas?