I have an Asp.Net MVC web application sitting inside a website, still largely controlled by delphi. Currently, management is done using delphi, which creates cookies.
It was decided to authenticate users in the ASP.Net application by retrieving the cookie data and passing it to the imported Delphi DLL, which returns true or false depending on whether the user is valid.
My plan was to use forms authentication, but instead of redirecting the user to the form instead of calling the delphi shell, and if successful, redirect the user to the original url. This has the advantage that when security is migrated to .Net, the authentication infrastructure will already exist, it just needs to be changed.
public ActionResult LogOn(SecurityCookies model, string returnUrl)
{
try
{
if (model != null)
{
Log.DebugFormat("User login: Id:{0}, Key:{1}", model.UserId, model.Key);
if (authenticator.UserValid(model.UserId, model.Key, 0))
{
FormsService.SignIn(model.UserId, false);
return Redirect(returnUrl);
}
}
...
Please note that SecurityCookies are generated by a special binding class from the delphi cookie created - this works well.
Calling delphi dll also works fine.
, , , .Net- ajax-.
, , 3 - :
1) ajax
2) ~/Account/Logon ( )
3) ajax
, , , , 3 , .
, ~/account/Logon .
, jQuery : $.getJSON(requestString, () { // - });
, Url, , ? , .