How to throw a UserFriendlyException in angular application? - aspnetboilerplate

How to throw a UserFriendlyException from an angular component.ts
any examples?
[Abp 3.4.1 template .net core + Angular]

there's client command. use the below
abp.message.error("test")

Related

How to implement leptonX theme

I was trying to add the new leptonX theme provided by ABP framework. But i couldn't find a doc for the MVC project. There is one for the angular. Have anybody tried adding to MVC project?
In your web project, you need to run the command:
abp add-package Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX --prerelease
Or
dotnet add package Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX --prerelease
Follow instructions as per Abp Team: https://docs.abp.io/en/commercial/latest/themes/lepton-x/commercial/mvc

Upload IFormFile using Refit in .Net Core 3.1

I am using Refit current stable version in .Net Core 3.1 application and want to call an API from MVC application with IFormFile property in request model. I have added Multipart attribute at endpoint declaration. I don't want to replace IFormFile with anything else as I have used this across entire project.
Any solution for this please?

Best practices for Swagger UI in production

I'm working on a REST API with a Swagger UI. When it comes time to expose the API, should I expose the Swagger UI as well? If so, how would I package it into my application. Currently, I have the UI downloaded from the GitHub and am storing it in a folder alongside my project.
I'm using Go (with the Echo framework) to write the API.
We should not enable swagger in production due to security threats.
In.net core version 6.0 version, we can protect it with the below code in Program.cs.
if(!app.Environment.IsProduction())
{
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My Service");
c.RoutePrefix = string.Empty; // Set Swagger UI at apps root
});
}

Missing Method MachineKey::Protect() error when running SignalR 1.2.1 with Mono 3.12.1 & Raspberry Pi

I am 'migrating' a MVC WebApplication to a Raspberry Pi 2. The original Web Application uses SignalR 2.x. After googling for weeks, I believe that the lastest Mono 4.0.1 only supports self-hosted SignalR server due to OWIN issue (ref here). So I tried to revert back to SignalR 1.x to avoid using OWIN middleware approach.
I followed the SignalR 1.x tutorial here and was able to run the sample, except that when $.connection.hub.start() is called in the client's browser, the xsp4 server throws the following exception:
Missing method System.Web.Security.MachineKey::Protect(byte[],string[]) in assembly /usr/lib/mono/gac/System.Web/4.0.0.0__b03f5f7f11d50a3a/System.Web.dll, referenced in assembly /tmp/pi-temp-aspnet-0/1543474b/assembly/shadow/c3a92c68/a3f2fa86_605bd6ee_00000001/Microsoft.AspNet.SignalR.SystemWeb.dll
The RouteTable.Routes.MapHubs() in Application_Start() seems to work OK as I can get the generated /signalr/hubs script without problem.
It seems that this function System.Web.Security.MachineKey::Protect() is not implemented in mono. I wonder if anyone has any workaround to this error.
Thank you very much in advance.

How to Upgrade Web API to Web API 2

I got some information for upgrading MVC 4 and Web API to MVC 5 and Web API 2
http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
I followed the steps from that hyperlink.
For upgrading from Web API to Web API 2, in global.asax, change:
WebApiConfig.Register(GlobalConfiguration.Configuration);
to
GlobalConfiguration.Configure(WebApiConfig.Register);
I am unable to find Configure() under GlobalConfiguration. Am I missing any reference here or am I supposed to include any definition or namespace?
if you have :
using System.Web.Http;
at the top of your file, then check if your project is actually referencing MVC 5 / Web API 2 assemblies

Resources