Edit2 : What i found is that it logins correctly and give the cookie of the user ( .AspNet.ApplicationCookie ) but when it is there ( when running on the deployed version of the WebApp, not locally) nothing will load, so the eternal load is simply a redirect to the home page, i don't know what it could be..
At first i tought it was the Database connection that was wrong or something... but i just realised by login in the admin panel locally that the accounts i was trying to register using the deployed Web App were registering in the DB successfully, even though after doing the registration you are stuck in an eternal loading screen..
I don't know what could be wrong since it is 100% functional locally , but somehow it seems like you can't sign in/login when it is deployed in Azure.
Edit : Somehow this morning i've tried logging in and it gave me a Runtime Error :
Server Error in '/' Application. Runtime Error Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated
Now i've been asked the more info :
When you test locally, make certain that the application is not creating any .mdf files in within your project's App_Data folder on the filesystem. If it is, this is a sure indication as to why it works locally but not when deployed to azure. Technically, you can have separate connection strings and thus separate databases for your application and your application services.
When i test locally, no file is made in the App_Data folder as it uses the same database while deploying as when running it locally -> can register new accounts locally and on the deploy
Now for this :
Please update your question with your web.config file. Be sure to
include the membership and roleManager sections under
. The exception message indicates that the connection string name you are using for application services (meaning membership, role management, etc) is referencing a database that lives in your App_Data directory. Be sure to omit any usernames and passwords from your when you post the web.config.
In my Web.config i do not have any roleManager section nor membership(i don't use membership but i do use roleManager?)
as per requested here is some important code with the registration :
This is what happens when someone register ( AccountController )
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
user.Subscribed = false;
user.StartSubscription = new DateTime?();
user.EndSubscription = null;
user.paypalProfileID = null;
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
// Send an email with this link
// string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
// var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
// await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
return RedirectToAction("Index", "Home");
}
AddErrors(result);
}
// If we got this far, something failed, redisplay form
return View(model);
}
and this is the ApplicationUser identity :
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
public string paypalProfileID { get; set; }
public bool? Subscribed { get; set; }
public DateTime? StartSubscription { get; set; }
public DateTime? EndSubscription { get; set; }
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}