This is a discussion on HttpException - Session State not enabled. within the .Net Development forums, part of the Programming & Scripting category; I've got a head scratcher. In my master page I have: if (Session.IsNewSession) .... In two of my pages that ...
| |||||||
|
#1
| ||||
| ||||
| I've got a head scratcher. In my master page I have: if (Session.IsNewSession) .... In two of my pages that are content pages of the master, I'm now getting an HttpException -- Session state can only be used when enableSessionState is set to true... The other 10 or so content page work fine. In no place in the application do I have EnableSessioState="false". Even after the exception is thrown, I can navigate back to one of the other working pages, and everything seems fine and dandy -- until I attempt to load one of broken pages. I'm at a total loss as to how to shoot this bug. Anybody have a clue as to how I can determine when SessionState is being disabled? [Edit] The offending line of code in the Page_Load event.[/edit]
__________________ Wolffy ------------------------ Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. Last edited by Wolffy; May 20th, 2008 at 04:56 PM. |
|
#2
| ||||
| ||||
| Have you tried setting EnableSessionState="true" in the page directive of those content pages to see if it will work then?
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#4
| ||||
| ||||
| Thanks goodness for SCM's. The problem pages were ones that I had only made a minor change to; it was simple to go back to the most recent working version and my problem was solved. We use a product from DevPartners to do an automated source code review prior to going QA. It flagged about 1200 lines of my code as problems (way more than 50% being in source files created by Visual Studio. The Designer.cs files being the worst offenders). Once of the 'suggestions' it made was to change: Code: <asp:HiddenField ID="hfACTIVE_CD" Value='<%# Bind("ACTIVE_CD") %>' runat="server" />
//to
<asp:HiddenField ID="hfACTIVE_CD" Value='<%# Server.HtmlEncode(Bind("ACTIVE_CD")) %>' runat="server" />
Since this was the only line of code I changed in this file, I removed the Server.HtmlEncode and solved the problem. Since the HtmlException was so far removed from the problem line, it took me a bit to suspect this change. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |