Hi Monks,

While working on an existing Perl/Mason project, suddenly it happened that when logging into the site as a user, am getting Access Denied error. I noticed that the login_submit.html page properly authenticates the user and is updating the session variable with the logged-in user's id within the login_submit.html page.

$m->session->{user_id} = $User->user_id;

Then its redirected to another page ( say my.html ). But once redirected, I am getting Access Denied error because $m->session->{user_id} is no longer accessible there. if I check browser's session storage, I cannot find the session key/value set for user_id .

Any idea what could be the reason ?

I have not changed any configuration setting in Dhandler.pm script. Though I am pasting it below for your reference, in case someone can think of a possible reason.

# Create Mason ApacheHandler object. my $mason = new HTML::Mason::ApacheHandler( comp_root => [ [ document_root => $MYPROJECT::DOCUMEN +TS_DIR ], [ lib => "$MYPROJECT::ROOT_D +IR/mason_lib" ], ], data_dir => "$MYPROJECT::ROOT_DIR/tmp/mason", autohandler_name => '.autohandler.mas', dhandler_name => '.dhandler.mas', allow_globals => [ qw/$dbh $Member %Cookies $Exception $Si +te/ ], decline_dirs => 1, error_mode => 'fatal', request_class => 'MasonX::Request::WithApacheSession', session_class => 'Apache::Session::MySQL', session_use_cookie => 1, session_cookie_name => 'session_id', session_cookie_expires => '+3d', session_cookie_resend => 1, args_method => "mod_perl", session_handle => $dbh, session_lock_handle => $dbh, );
Note: Everything was working fine and I am almost 99% sure that I have not changed something that would have broken the login function. I was in fact working on a form update function which updates the User table.

In reply to Perl Mason | Session Hash not stored in Browser by premsai

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.