# Session riding

**URL:** <https://www.ruby-forum.com/t/session-riding/79986>\
**Category:** Ruby\
**Created:** [December 29, 2005, 2:43am UTC](https://www.ruby-forum.com/t/session-riding/79986 "2005-12-29T02:43:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chad\_Layton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/48db29/32.png) [@Chad\_Layton](https://www.ruby-forum.com/u/Chad_Layton)\
**Post date:** [December 29, 2005, 2:43am UTC](https://www.ruby-forum.com/t/session-riding/79986/1 "2005-12-29T02:43:49Z")

</div>

When a user browses my script I’d like to grab a session cookie from the  
browser, then use that cookie to request html from a site the user has  
already logged in to. I’ve been struggling with this for a few days now,  
is it even possible? It seems like it should be but I can think of a  
couple of Bad Things one could do with it.

Anyways, my intentions are benign. I’d like to do some screen scraping  
from a site that requires a login but I dont want to force people to  
trust me with their information (at least sessions expire).

---

<div class="post-metadata">

**Author:** ![Chad\_Layton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/48db29/32.png) [@Chad\_Layton](https://www.ruby-forum.com/u/Chad_Layton)\
**Post date:** [December 29, 2005, 2:50am UTC](https://www.ruby-forum.com/t/session-riding/79986/2 "2005-12-29T02:50:47Z")

</div>

Chad Layton wrote:

> When a user browses my script I’d like to grab a session cookie from the  
> browser, then use that cookie to request html from a site the user has  
> already logged in to. I’ve been struggling with this for a few days now,  
> is it even possible? It seems like it should be but I can think of a  
> couple of Bad Things one could do with it.
> 
> Anyways, my intentions are benign. I’d like to do some screen scraping  
> from a site that requires a login but I dont want to force people to  
> trust me with their information (at least sessions expire).

A normal browser will only send you cookies in the same  
domain as the request, so this is likely not possible.

E
