I think you have to migrate your solution INTO a new blank 4.1 project, and make your code revisions in 4.1, either that, or review the changed files in 4.1 and make the same modifications in your existing 4.0.
I'm now having some success by simply using an AJAX POST with url: abp.appPath + 'api/services/app/profile/GetCurrentUserProfileForEdit' and storing the response in abpUser object. This returns all current user profile properties which I can then inspect via code. Is there a better way?
I'd like "AutoRefresh" true/false to be a property of the user - this is so that an Admin can pre-create a user and set this property in CreateEditUser modal AND the user can access the property from the MySettings modal. I have already got that far and I can display/set the property in those modals I mentioned.
What I am now stuck with, is how to read that value from any page or a controller action.
I'm almost getting there, I feel very close to a solution by using "abp.services.app.profile" in client side script and I see the http 200 response body containing the current user profile data - but for some reason I am unable to capture that response into an object.
OK, I'm really stuck with this one.
I am able to EXTEND an existing entity (the user) and can use the existing CreateEditUser modal and UserSettings modal to display and change the vale (it's a checkbox/boolean) - but I am lost as to HOW to retrieve that value using abp.settings (client side) or using a controller action. The stored value is in the abpUsers table.
or,
I am able to add new pre-defined User Visible settings and I can retrieve the values of these using client side abp.settings (and probably with a controller action) (these are stored in abpSettings table) but I am completely lost as to how to implement the display/changing of that value in the CreateEditUser modal or UserSettings modal.
Basically, I'd like to implement a per-user true/false setting (called AutoRefresh) that the user can access via their own settings, or the admin can set on a user account via the user editing. When a page loads, I'd like to test for that value and run code as appropriately.
I followed this guide to extend the User Entity, simply adding to User.cs and ran a migration:
<a class="postlink" href="https://aspnetzero.com/Documents/Extending-Existing-Entities">https://aspnetzero.com/Documents/Extend ... g-Entities</a>
...so I did not 'define' my new setting and there is nowhere to set IsVisibleToClients to true. Is that the wrong way to implement user-based settings, have I misunderstood? Is it possible to get the value of an extended property using SettingManager or is that only for retrieving values defined using SettingProvider?
If I follow your suggestion of defining a new setting using SettingProvider, would that then be stored in the AbpSettings table instead of AbpUsers and show user specific values for the TenantId and UserId field instead of NULL?
Can I just add additional User based settings to the AppSettingProvider.cs?
It's OK, I found answer here:
<a class="postlink" href="https://aspnetzero.com/Documents/Extending-Existing-Entities#add-new-property-to-user">https://aspnetzero.com/Documents/Extend ... ty-to-user</a>
Thanks for the guide!
OK, So I think I have the desired result by modifying the web.config to include the following in system.webServer :
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" path="/Error/E500" responseMode="ExecuteURL" />
</httpErrors>
When a 500 error is encountered, now the page goes to the /Error/E500 page, which is generated by the ErrorController using the _layout.cshtml.
I understand that potentially, if ASP.NET is having issues itself, then the MVC system may not actually return what I need - but hell, the app would be broken so I'm not sure I care so much!
P.S. - That is also for Error 404 - not 500, there may be a difference in handling 500 errors in an MVC application? Maybe with a 500 error we cannot go to a view from a controller and it has to be a static page?
<cite>ismcagdas: </cite> Hi,
You can define a custom page for each error code in your project. You need to set it in web.config like we did for E404 here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/9ec982ce90c2767c7c50d5bc0b834f68c2d43feb/src/MyCompanyName.AbpZeroTemplate.Web/Web.config#L71">https://github.com/aspnetzero/aspnet-ze ... config#L71</a>.
Yes, I have seen and like the Github Error 404 page, however that is NOT within an ASPNETZERO project is it.
If you care to look at my code samples I posted, I do have the web.config configured with a custom redirect for 500 and the necessary E500.cshtml page and modified ErrorController.cs- but the redirect is not occuring - instead the site loads the /Shared/error.cshtml page. If I go directly to "/Error/E500" then I get my custom error page, so I know the controller and page are fine - it is that the site is not redirecting, and instead loading the contents of the /Shared/error.cshtml page - which looks awful.
OK, so I have been reading this blog;
<a class="postlink" href="http://benfoster.io/blog/aspnet-mvc-custom-error-pages">http://benfoster.io/blog/aspnet-mvc-custom-error-pages</a>
and I have discovered that outside of the 404 error handling, ASPNETZERO returns the /Shared/error.cshtml - which doesn't look pretty at all (formatting is all messed up as it doesn't use the layout template.)
I tried looking to see if there was a "HandleErrorAttribute" global filter in my project but I can not find one. How to I get ASPNETZERO to redirect to /Error/E500 when encountering Error 500?
Thanks, Andy.