Is it possible to transfer session data from an asp.net mvc application and a python application?

I would like to be able to share some data between the asp.net mpc application and the python / django application. The type of data I would like to provide is authentication or session data.

+8
django asp.net-mvc
source share
4 answers

This, of course, is possible as long as you gain access to some shared resources between both frameworks. There are probably several ways to do this, but one of the most obvious is to use some common backup storage, i.e. or maybe even memcached, which will be faster. I am not a Django user, but as far as I know, memcached is supported in it ...

There is, of course, a more complex scenario associated with this, and that is data compatibility . You will probably have to use some kind of interchangeable format that both structures understand, i.e. XML, JSON, BSON or the like. Therefore, even when using memcached, you will have to do this translation.

+4
source share

How do I share a session ...

Make Session Cookie Subdomain Aggregation

<httpCookies domain=".mydomain.tld" /> 

I have two of my subdomains in which I want to share a session between

 www.mydomain.tld [ASP.net MVC app] extra.mydomain.tld [Python app] 

Create a simple web service or generic handler in ASP.net that returns a user session serialized in JSON or XML.

If you use a generic handler, be sure to use the IReadOnlySessionState or IRequiresSessionState interfaces in the class.

Now from extra.mydomain.tld you can call your handler or service www.mydomain.tld / [Get / Set] SessionValue. It will take your cookie ".mydomain.tld" and allow the exchange of modifying values.

+3
source share

I would recommend the following approach using a shared database (maybe a shared cache or any other data store):

  • When a user accesses one of your applications in your domain, you create a cookie with the key "_shared_session" and with the value of a random string generated by your application;
  • Store the value of this cookie in the database and associate it with a JSON object containing the data that you want to share between applications;
  • When a user accesses another application, you check if a cookie exists with the key "_shared_session" and reads its value;
  • With a cookie value, you can get a shared JSON object.

Quick answer: there should be a filter that searches for a common cookie before creating a new session

+2
source share

There is an option to save session state in the MS SQL Server database, which is available out of the box. Use the steps from the following kb http://support.microsoft.com/kb/317604 This is more about configuration, not implementation. You can write your own storage provider, but is there a reason for this?

I am not familiar with python, but there are at least ODBC drivers for it http://wiki.python.org/moin/SQL%20Server

0
source share

All Articles