Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old March 4th, 2004, 01:22 AM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
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..

Reply With Quote
  #2  
Old March 4th, 2004, 06:34 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old March 4th, 2004, 02:51 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Quote:
Originally Posted by netytan
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.

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

Reply With Quote
  #4  
Old March 4th, 2004, 04:37 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #5  
Old March 4th, 2004, 06:50 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Quote:
Originally Posted by netytan
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.


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

Reply With Quote
  #6  
Old March 4th, 2004, 07:18 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #7  
Old March 4th, 2004, 08:00 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Quote:
Originally Posted by netytan
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.


Thanks Mark, it's working beautiful.

Reply With Quote
  #8  
Old March 5th, 2004, 05:34 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
No probs, happy to help ya out - knowledge is for sharing after all. Good luck with the app!

Mark.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > How to redirect a page with mime info


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway