Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "cosmic"

Answer

Yes, customErrors is set On. It was a first thing I changed.

Question

Hi, I have this code in the MVC controller:

public async Task<ActionResult> Edit(long? id)
{
    if (id == null)
    {
        throw new UserFriendlyException("Bad request");
    }

    var output = await _userAppService.GetAsync(new GetUserInput(id.Value));

    if (output.User == null)
    {
        throw new UserFriendlyException(L("InvalidUser"));
    }

    return View(output.User.MapTo<UserEditViewModel>());
}

If the ID is not supplied, then it will throw an UserFriendlyException, this is correct. But, when I look into the log file, there is following exception:

2015-04-17 13:43:06.1042|ERROR|Default|Abp.UI.UserFriendlyException: Bad request
   at Controllers.UsersController.<Edit>d__f.MoveNext() in c:\...\Controllers\UsersController.cs:line 109
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task)
   at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

It looks like a result of unhandled exception. I think, the UserFriendlyException (AbpException) is not handled correctly. In log file should be only first line, or am I wrong?

Hi, is it possible to use ABP XML localization source in DataAnnotations?

For example, with the Resource file it works:

[Required]
[Display(ResourceType = typeof(MyResource), Name = "Password")]
public string Password { get; set; }

But, is it possible to do with the XML file localization source defined in the ABP module as a DictionaryBasedLocalizationSource?

Answer

It works in PostInitialize section. Thank you.

I solved it. It was really simple, just one line of code to add a new menu

context.Manager.Menus.Add("TopMenu", new MenuDefinition("TopMenu", new FixedLocalizableString("Top menu")));

In your code is it exactly same as my solution, thank you for help.

Question

Hi, is there any way to define two unique menus in one module? I need two menus in my web application, one in the sidebar (MainMenu) and one in the top bar (TopMenu). Thank you for help.

Question

Hi, is it possible to load settings from DB by the SettingManager in the Initialize section of the module? When are the settings loaded from DB?

I have defined custom setting manager in the PreInitialize section of the module

Configuration.Settings.Providers.Add<WebSettingProvider>();

In the Initialize section of the web module I have defined BundleConfig and I need the settings to be accessible in this class, but when I tested this, the result was no settings (see attached image). But if I try to load the settings e.g. in the MVC Controller, everything is OK.

Any ideas? Thank you.

Showing 21 to 27 of 27 entries