RTC Forums
May 15, 2024, 10:44:58 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Multiple cookies/sessions  (Read 5391 times)
clockon
RTC Expired
*
Posts: 22


« on: April 08, 2014, 01:51:58 AM »

hi

ive modified the OnCheckRequest on my data provider to handle URLs in the form as

'/dispatcher/action/parameters/' (/account/profile/?id=2')

rather than

'/?dispatcher=account&action=profile%id=2'

this all seems to work fine but if i go to different dispatchers i am getting a new cookie for each one, so it cannot find the session for the user and so it is starting a new session per dispatcher.

is there something else in the source or something that is determining when to create a new cookie? or cannot i basically do what im after here. I was just trying to formulate a cleaning URL string.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: April 08, 2014, 08:28:06 AM »

1. As already mentioned in a reply to THIS POST, only one physical connection can keep a lock on a Session at a time. If your Server is multi-threaded and you have more than one physical connection, when both connections try to lock a Session at the same time, only one will succeed. The other one will fail, because access to a Session object is exclusive.

2. If you do NOT manually unlock a Session in your code, the Session object will remain locked until the end of a request/response chain that acquired the lock.

3. When working with TRtcDataProvider components, you have full control over Sessions and Cookies. There is no RTC code which would create Cookies automatically. If a cookie is being created, it is being created because you wrote that code.

4. Without seing your code, it is hard for me to know what you are doing. If you have more questions about Sessions and Cookies, please post the code you wrote for handling them.

Best Regards,
Danijel Tkalcec
Logged
clockon
RTC Expired
*
Posts: 22


« Reply #2 on: April 08, 2014, 01:13:09 PM »

Hi

I'll try put together some code for you. I basically took one of the demos and changed the onDataReceived to handle the urls I sent earlier.

If I leave my code the same and use parameters to look up the appropriate dispatcher it works with no other changes. Which is why I was wondering if the lookup for files was causing any issues in the source. The session is definately been unlocked that I checked. I'll let u no if I get a demo for you. I've reverted back for the time being.

Thanks
Logged
clockon
RTC Expired
*
Posts: 22


« Reply #3 on: April 08, 2014, 01:15:58 PM »

If I out together a demo is there a way to send a project privately?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #4 on: April 08, 2014, 01:34:29 PM »

Put all the files into a ZIP and send them to:


Best Regards,
Danijel Tkalcec
Logged
clockon
RTC Expired
*
Posts: 22


« Reply #5 on: April 09, 2014, 02:13:23 AM »

reading through some of the other posts i found this one.

i basically have the same issue. If a client comes in on /demo they respond with a session id from a cookie, which is fine. They then change the address to /test and they respond with a different cookie. As im outputting the Cookie.Text the values are either not there or different to the original. When is a cookie created and how does it know which cookie to respond with?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #6 on: April 09, 2014, 10:25:21 AM »

RTC SDK does not create cookies automatically. You create a cookies in your own code, by using the TRtcDataServer(Sender).Response.Cookie property when sending a response back to the Client. And when a Client sends a Cookie back to the Server, it will be in the TRtcDataServer(Sender).Request.Cookie property.

Best Regards,
Danijel Tkalcec
Logged
clockon
RTC Expired
*
Posts: 22


« Reply #7 on: April 09, 2014, 10:57:44 PM »

I dint think I said it creates it automatically. My question is how does the client work out which cookie relates to a page to send back?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #8 on: April 09, 2014, 11:37:42 PM »

Are you using the RTC SDK to write a Server, a Client or both?

If you are using the RTC SDK to write the Web Server (using a Web Browser as a Client), then you should check how that Web Browser handles cookies. From the Server point of view, you just send a Cookie to the Client as a response, and will get a cookie from the Client in a request, if the Client sends it. But you do not have control over the Client. The Client can refuse to store cookies, or handle cookies any way they want. Cookies on the Client side are not under Servers control.

PS. When writing Web Applications, I avoid the use of cookies, because a lot of people disable cookies for security reasons. Instead of using Cookies, I would recommend sending a Session ID as part of the URL.

Best Regards,
Danijel Tkalcec
Logged
clockon
RTC Expired
*
Posts: 22


« Reply #9 on: April 10, 2014, 12:25:45 AM »

Hi

its just a web server using a standard web page. just thought i would ask if you knew, i will investigate that part of it, thanks anyway.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.025 seconds with 16 queries.