Our solution inside of ASP.NET Zero
Login.cshtml:
<input type="hidden" name="returnHash" id="returnHash" />
Login.js:
$("#returnHash").val(window.location.hash);
LoginViewModel.cs:
public string ReturnHash { get; set; }
AccountController.cs:
//After inital set returnUrl
if (!string.IsNullOrWhiteSpace(loginModel.ReturnHash))
{
returnUrl = returnUrl +'/'+ loginModel.ReturnHash;
}
I've been working with the front end disabled.
If the return URL is an application URL i.e. /Application#/tenant/usersin the AccountController<ActionResult>.Login the return url only has "/Application" nothing past the hash.
How can we get the internal application working without the #, or how can we get c# to accept the string past the has in the parameters of that method?
I tested this in a plain demo from the Zero site and recreated this issue. If I copy the users URL, log out, paste, then log in, I am redirected to the dashboard.
<cite>hikalkan: </cite>
Have you overrided OnModelCreating or Initialize methods of your DbContext also? If so, call base methods as first line.
That was it, thank you so much. Great support as always.
After importing the migrations from Zero, I need to manually make the EF model and have it not update my database.
Running a working Zero install after my model changes and I got
System.InvalidOperationException: The model backing the 'DbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
I cannot chance migrating into my existing schema. I've had this before in other APB projects and added,
Database.SetInitializer<DbContext>(null);
into the DbContext constructor.
Now I am stuck with an error,
System.ApplicationException: Filter name MustHaveTenant not found
Do I need to create a custom DbInitializer that deals with these new Zero Filters?
ERROR 2015-06-23 13:09:49,494 [292 ] .Mvc.Controllers.AbpHandleErrorAttribute - System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
**EDIT
This error is with LDAP working, but something else is wrong. I tested with incorrect domain information and got a different error, then with incorrect user information and got a login invalid error. It seems to be working correctly but after it authenticates this error comes up.
I think I have found out the issue here. I will let you know if I found a fix, thanks.
When you say " application has no restriction" are you meaning there is some setup to allow some defaults to work within the AD configurations?
I have everything setup now, LDAP is enabled (MT disabled, admin logs in correctly), but when logging into the application with an LDAP account it simply errors with either an internal error or invalid credentials. Does the AD account need to create it's own user in the Iteration Zero project, or are there changes in the Zero Localization files to accommodate AD containers, domains and admin users rights?
The /Account/Logout worked. That was an interesting problem. Thank you for that solution.
Now that Multi Tenancy is disabled for LDAP, we basically fill out the AppLdapAuthenticaionSource method to get ldap working correct?
Using the quick start guide I created a fresh database using the EF migrations. I then disabled multi tenancy,
Configuration.MultiTenancy.IsEnabled = false;
After running the app it errors out with a null reference trying to find a UserName on a null User object here,
if (!IsMultiTenancyEnabled)
{
return LoginInformations.User.UserName;
}
in the HeaderViewModel.cs file.
Any ideas on what's going on?