Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Fellow Monasterians:

Using CGI::Application::Plugin::Session and CGI::Application::Plugin::Redirect I was struggling with a session cookie being rewritten and losing values between trips to the server. Finally another coder pointed me to this piece that states:

Redirection—or any other non standard (200 OK) output page HTTP result —does not allow additional HTTP headers to be added to the request, which effectively means you cannot Redirect and send a cookie on the same request. Instead you have to create an intermediate page contains redirect link in a META tag, or a phyical HREF link the user clicks on to go to the next page. HTML pages and browsers support the META Refresh tag which makes this possible."

Seems kludgy at best, so I was wondering if there is another way to get around this? Here's the scenario:

Submission of | [login.tmpl] form | fires instance script | [login.cgi] | that calls | [Login.pm] | which authenticates user and assigns the user's id to | $self->session->param('user_id' => $user_id) | and then | $self->redirects('admin.cgi'), an instance script which fires | [Admin.pm] | which tries to retrieve | $self->session->param('user_id') | which is undef'ed

So, is there a way to avoid the HTML metatag redirect method and keep it Perlish? Thanks!

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

In reply to CGI::Application redirect loses cookie by bradcathey

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2024-04-19 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found