I have an ASP.NET web service that provides a DoLogin method
[WebService(Namespace = "http://rtns.ism.ec/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public class UserManagerService : WebServiceBase
{
[WebMethod(EnableSession=true)]
[ScriptMethod]
public ResponseBase<bool> DoLogin(LoginCredentials Credentials)
{
Credentials.IpAddress = HttpContext.Current.Request.UserHostAddress;
Credentials.ServerID = Environment.MachineName;
Credentials.SystemID = WebConfigurationManager.AppSettings["SYSTEM_ID"];
Credentials.UserAgent = HttpContext.Current.Request.UserAgent;
try
{
DataResponse<User> resp = UserManager.LoginUser(Credentials);
if (resp.Code)
{
FormsAuthentication.SetAuthCookie(Credentials.Email, true);
HttpContext.Current.Session.Add(Constants.Identifiers.USER_SESSION_INFO_IDENTIFIER, resp.Data);
}
return resp;
}
catch (Exception _ex)
{
ISM.Essentials.Business.LogManager.SaveLog(_ex);
return new ResponseBase<bool> { Message = MessageManager.Instance[Constants.Messages.E_GENERIC_FAILURE, Credentials.CultureID] };
}
}
}
I have a jQuery client that calls a call:
function loginSubmitHandler() {
var objeto = {
Email: $('#txtUser').val(),
Password: $('#txtPassword').val(),
CultureID: $('#hddCulture').val()
};
utils.startAjaxCall('../Services/UserManagerService.asmx/DoLogin', { Credentials: objeto }, function(data) {
if (data.d.Code) {
window.location.replace('home.aspx');
}
else
{
utils.alert(locals.Information, locals.Accept, data.d.Message);
}
});
return false;
}
When I log in with the icorrect credentials, a warning appears with a message sent from the server. If I give the correct credentials, the page is redirected to home.aspx
This code works 100% from the very beginning in the following browsers:
- IE6, 7, 8, 9
- Mozilla
- IE9 Windows Phone
- Android 2.3 Browser
- Safari 5.1 for Windows
I just got a Mac (ever), and when I tried to access my site, I noticed extrange behavior. I give the correct credentials, they redirect me to the house, but the FormsAuthentication mechanism redirects back to the login page.
, cookie Auth, , .
cookie, - -/.
, Safari Mac cookie, - Ajax?