views:

32

answers:

2

Hi fellow programmers,

I have a c# application that defines a membership provider used in a Asp.Net MVC application. And i have an apache httpd server that does authentication with mod_wsgi.

The objective is to share the membership provider between the two, so that the authentication information be the same.

How can i achieve this behaviour ?

+1  A: 

Trivially.

  1. Apache serves static content.

  2. Certain URI's will be routed to mod_wsgi to Python.

  3. Python will then execute (via subprocess) a C# program, providing command-line arguments, and reading the standard output response from the C# program.

  4. Python does whatever else is required to serve the web pages.

This presumes your C# application runs at the command line, reads command-line parameters and writes its result to standard output. This is an easy thing to build. It may not be the way it works today, but any program that runs from the command line is trivial to integrate.

Your C# application, BTW, can also be rewritten into Python. It isn't magic. It's just code. Read the code, understand the code, and translate the code. You'll be a lot happier replacing the C# with something simpler.

S.Lott
the membership provider was implemented by me. i need it to use in a asp.net application. what i want to achieve is the authentication information to be the same in apache and asp.net application.
fampinheiro
@fampinheiro: "the membership provider was implemented by me" Then it will be very easy to rewrite into Python. As long as the **underlying data** is the same between C# and Python providers, you're ASP.Net and Python applications will match. The code doesn't have to be the same, just the data has to agree.
S.Lott
A: 

Several ways:

  1. COM interface (if Windows OS), although this would be a bit slow (make a COM-compatible library, register it with regasm, use it).
  2. Using Gearman (not sure if faster than COM and whether it has Python and C# support, the investigation is up to you) http://gearman.org/
  3. Using the method described by S.Lott
  4. Using SOAP (slow, big)
Alexander
yes, i am in windows, but COM knowledge == 0. Gearmen need to look into it. SOAP is too much work for something so simple.
fampinheiro
You don't have to have COM knowledge. You simply make an interface for your class, try not using complex data types, stick to int, string and float, assign GUIDs for your classes and methods, register it with regasm and then it should be Python syntax when using an object initialized with COM. Haven't worked with Python, but if PHP allows instantiation of COM classes, why shouldn't Python be able?The internet is full of so many simple tutorials how to register COM classes made in .NET. Google, it, your fears will disappear.
Alexander