You are here: Re: FormsAuthentication to PHP « All PHP « IT news, forums, messages
Re: FormsAuthentication to PHP

Posted by NC on 09/20/06 17:48

Kim André Akerø wrote:
>
> I'm trying to make my PHP scripts communicate with
> a ASP.NET based authentication solution.
>
> I have $_COOKIE["FormsAuth"], but it's encrypted using
> the FormsAuthentication.Encrypt method.

FormsAuthentication.Encrypt produces a serialized
FormsAuthenticationTicket object...

> Is there a way to decrypt this cookie using PHP?

Yes, but only on Windows. You'll have to define a COM or a DOTNET
object and decrypt the cookie the Windows way, using
FormsAuthentication.Decrypt...

A much simpler solution would be to tweak with the ASP.Net code and
have it explicitly set cookies based on FormsAuthenticationTicket
properties (CookiePath, Expiration, Expired, IsPersistent, IssueDate,
Name, UserData, Version). Something along these lines:

Dim cookie As HttpCookie
cookie = New HttpCookie("Expiration")
cookie.Value = authTicket.Expiration.ToString
Response.Cookies.Add(cookie)

Then, instead of dealing with the serialized object in
$_COOKIE["FormsAuth"], you would be dealing with plain and simple
$_COOKIE['Expiration'].

My guess is that about the only value you really need is Expiration...

Cheers,
NC

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация