Closed Thread
Results 1 to 4 of 4

Thread: HttpException - Session State not enabled.

  1. #1
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    1,037
    Blog Entries
    2
    Rep Power
    13

    HttpException - Session State not enabled.

    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]
    Last edited by Wolffy; May 20th, 2008 at 04:56 PM.
    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.

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    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, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  3. #3
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    1,037
    Blog Entries
    2
    Rep Power
    13

    Nope, but I'll put that idea into my bag-o-tricks today.
    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.

  4. #4
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    1,037
    Blog Entries
    2
    Rep Power
    13

    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" />
    
    Actually it suggested Server.HTMLEncode, so I was a bit suspicious and only change it in two places rather than the 100's of places that I bind.

    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.
    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.

Closed Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO