开发者

Maintaining session by rewriting URL

I'm developing a JavaScript library supporting HTTP Streaming and WebSocket, jQuery Stream . I used XDomainRequest to perform HTTP Streaming when user's browser is IE8+, but there is one problem.

The problem is that user's session is not maintained and newly generated session is provided instead, because XDomainRequest excludes cookies when sending data to the server. Anyway, finally I found that it can be solved by rewriting URL.

So, I want to know how to rewrite URL to maintain user session in popular server-side technology such as .NET, PHP, Python and Ruby.

开发者_高级运维For example, in Java Servlet

/event-stream // by cookies
/event-stream;jsessionid=(The value of JSESSIONID contained in cookies) // by rewriting URL

Thanks in advance.


Java

/event-stream
/event-stream;jsessionid=(The value of JSESSIONID contained in cookies)

http://download.oracle.com/javaee/5/tutorial/doc/bnagm.html

PHP

/event-stream
/event-stream?PHPSESSID=(The value of PHPSESSID contained in cookies)

http://www.php.net/manual/en/session.idpassing.php

ASP.NET

/(app name)/event-stream
/(app name)/(S(The value of ASP.NET_SessionId contained in cookies))/event-stream/

http://msdn.microsoft.com/en-us/library/aa479315.aspx

Ruby on Rails and Django don't allow you to pass the session id!

The IE Team said that there are no plans to change this behavior (sending cookies).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜