How do I integrate ASP.NET Membership in PHP sites?

I am looking to use an open source CMS/blog site like WordPress or Drupal. I need it to work with the ASP.NET Membership I already have running my current website and community site.

I am assuming I need to muck with (hand write) some cookies to pass back and forth. So how would/have you done it? I am looking for creative ideas on how to make this happen smoothly and securely.

Related posts

Leave a Reply

2 comments

  1. Drupal has a layered and pluggable authentication system, you can use that to connect to any external system for authentication.

    As commentor points out below, “external system” may be a bit ambigous.

    It does not have to be some XMLRPC, REST, or bus system, it can be anything, from a textfile in a directory to a table filled with legacy accounts in a “local” MySQL database.
    Point is, this pluggable authentication layer allows for any none Drupal-users-database-table to hook in an allow/disallow authentications/registrations.

  2. I query the database for the appropriate fields and I use this to create my cookies in C# code, does that help you?

            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
               1,                            // version
               strUser,                      // user name
               DateTime.Now,                 // create time
               DateTime.Now.AddYears(1),     // expire time
               false,                        // persistent
               "my own data" );              // user data
            string strEncryptedTicket = FormsAuthentication.Encrypt( ticket );
            HttpCookie cookie = new HttpCookie( FormsAuthentication.FormsCookieName, strEncryptedTicket );
            Context.Response.Cookies.Add( cookie );
    

    As for the queries to be run, those are straightforward and documented if you have an aspnetdb instance already up with an asp.net app using them, but I could post more code if you need some stuff for accessing those as well. You were asking about the cookie, so this is how I set my cookies in C#