This question is related to ASP.NET forms authentication without redirection , I cannot get it to work. MVC 2 changed its script files, and now they got it, as indicated here:
http://www.asp.net/ajaxlibrary/CDNAjax4.ashx
Now I just shoot in the dark, but the trial version and the error narrowed me down to power on
MicrosoftAjax.js
MicrosoftAjaxCore.js
MicrosoftAjaxComponentModel.js
MicrosoftAjaxSerialization.js
MicrosoftAjaxNetwork.js
MicrosoftAjaxWebServices.js
MicrosoftAjaxApplicationServices.debug.js
The problem is that I get a javascript exception:
Microsoft JScript runtime error: Sys.InvalidOperationException: The web service path was not installed.
From googling around, I found that this path should be "~ / ScriptServices_AuthenticationService.asmx", but something like:
Sys.Services._AuthenticationService.DefaultWebServicePath = "~/ScriptServices_AuthenticationService.asmx";
not working (I assume this is a private member). So the question is, does anyone know how to make ajax / async FormsAuth work? Is there a definitive guide on which js file depends on the various MS ajax services? Finally, if none of the above is there, there is a way to make FormsAuth on the server side so that it does not redirect (so I can just call the controller action with the ajax form)? ... I tried using FormsAuthentication.SetAuthCookie (), but this did not seem to work for me.
:
, FormsAuthentication.SetAuthCookie() , , Response (, , ). , .
:
, . ajax . . ajax, , . :
public JsonResult CreateAsync(LoginForm form)
{
CreateAccount(form);
FormsAuthentication.RedirectFromLoginPage(form.Email, false);
return Json(
new
{
Email = form.Email,
Name = form.Name,
Message = "Success"
});
}
, . FormsAuth.SetAuthCookie, , .