On May 13, 3:23 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
> I am running into an issue where my session values are not remembered if
> I do an HTTP redirect.
>
> If I do:
>
> --
> request.session['a'] = 'aaaa'
> return HttpResponseRedirect(request.META['HTTP_REFERER']
> --
>
> The session variable a will not be available once the browser is redirected.
>
> If I do:
>
> --
> request.session['a'] = 'aaaa'
> render_to_response(...)
> --
>
> Then the session is available as expected.
>
> I have tried to set:
>
> request.session.modified = True
>
> but that does not change the behavior.
>
> Can session variables be set when doing a redirect?

Absolutely.

You should ensure that request.META['HTTP_REFERER'] doesn't redirect
to a different domain name that happens to map to the same
application. For example, if you set the session in a view at
http://127.0.0.1/myview/ and that view redirects to http://localhost/myview2/,
you will not be able to access the previous session.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to