|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
How to redirect a page with mime info
Hi.
Your help is highly appreciated. Im using apache server. Basically, I have a login page that authenticates a user. if the user was authenticated successfuly , then I want to send a cookie ( Session ID) and to redirect him to a new page. How can I do that? ( ( 'Location...') works if there is no mime information... ) It might sound a stupid question, but I can tell you I spent lots of time on that one.. |
|
#2
|
||||
|
||||
|
Mmmmm, you could try sending a meta refresh tag i.e.
Code:
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.address.com/"> http://www.htmlhelp.com/reference/html40/head/meta.html If you've already sent all the headers, although i'm not seeing why you cant send the Cookie header followed by the Location header? This is a CGI project yes? Mark. |
|
#3
|
|||
|
|||
|
Quote:
Hi Mark. If i'm sending the 'Location' after the header, then it doesn't work and the browser treats it like a plain text ( i mean, writing Location.....) This is so weared, it is such a basic functionality, and yet, it's looks like it is not very easy to implement |
|
#4
|
||||
|
||||
|
You can send more than one header at the same time as long as you dont have any blank lines since a blank like signals the end of the MIME header i.e.
Code:
MIME-Header MIME-Header MIME-Header MIME-Header Page-Content so... Code:
#!/usr/bin/env python print 'Content-Type: text/html' print 'Location: http://www.python.org\n' Obvously these headers aren't very useful but it does demonstrate how to send more than one header to the browser. Let me know if this doesn't work for you. Mark. |
|
#5
|
|||
|
|||
|
Quote:
Hi Mark, It doesn't work if I add cookies to the header, here's the exact code: Content-Type: text/html Set-Cookie: flare="FB187D1DD5L-270d9cf9"; Max-Age=3600; Version=1 Location: MenuGenerator.py?opMode=HomeMode |
|
#6
|
||||
|
||||
|
You need a new line between each mime header. Give that a go...
Content-Type: text/html Set-Cookie: flare="FB187D1DD5L-270d9cf9"; Max-Age=3600; Version=1 Location: MenuGenerator.py?opMode=HomeMode Mark. |
|
#7
|
|||
|
|||
|
Quote:
Thanks Mark, it's working beautiful. |
|
#8
|
||||
|
||||
|
No probs, happy to help ya out - knowledge is for sharing after all. Good luck with the app!
Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > How to redirect a page with mime info |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|