Posts

DnSpy: Getting Started

Image
  You can setup the website in your local environment and use the DnSpy tool to debug to any library   without its source code.    Please refer the belows steps to know how to debug with DnSpy: 1- Download the dnSpy ( https://github.com/dnSpy/dnSpy/releases/tag/v6.1.8 )  to your computer and  Run the dnSpy.exe as Administrator 2- Select Debug > Attach to Process, choose  w3wp.exe or iisexpress.exe 3- Select Debug > Windows > Modules tab window, search the customer DLL filename and copy the file path. This path is the actual the assembly runs in IIS website. Depend on your case, choose the *.dll file 4- Open this Dll file path in dnSpy, go to the class / method we want to debug () 5- Set the Breakpoint and start Debug like in the Visual Studio

Episerver ServiceAPI: Create a custom endpoint

Image
In some cases, you uploaded an asset through Service API. And then you want to update its properties later. You can create a custom endpoint to implement it and we want to reuse the authentication, routing  of ServiceAPI: https://github.com/KhanhPham2411/Episerver-util-api/blob/master/service-api/ItemAssetController using EPiServer.ServiceApi.Configuration; using EPiServer.ServiceApi.Validation; using EPiServer.ServiceApi.Commerce.Controllers.Catalog; using ControllerBase = EPiServer.ServiceApi.Commerce.Controllers.Catalog.ControllerBase; using AuthorizePermissionAttribute = EPiServer.ServiceApi.Configuration.AuthorizePermissionAttribute; using EPiServer.ServiceApi.Commerce; using Foundation.Features.Media; using EPiServer.DataAccess; using EPiServer.Security; using System.Configuration.Provider; namespace Foundation.Custom {     [Route("episerverapi/commerce")]     [RequireHttpsOrClose]     [ValidateReadOnlyMode(AllowedVerbs = HttpVerbs.Get)]   ...

Episerver Commerce 14: Menu access

Image
It's the CommerceUIMenuProvider that controls the general menu access, you can configure it in appsettings.json: (Compared to Commerce 13: <add name="CatalogManagers" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="CommerceSales" mode="Any" />) Common roles are: WebAdmins, WebEditors... In case you want to create an access group that enables access to only: Customers Order management Reports As the image below: we could use ReportManagers, CustomerManagers, CustomerServiceRepresentatives:  

Episerver Commerce Manager access: Permission for Functions

Image
  To access Commerce Manager site, we need grant access core:mng:login To access Payment: 3.  Allowing access permision to Order Management left side tabs Notes: The virtual roles only affect front-end site not Commerce manager The functions only affect Commerce Manager not front-end site

Episerver ServiceAPI: Example of how-to properly call the media upload

Image
For the example of how-to properly call the media upload, you can refer to my Postman collection: https://github.com/KhanhPham2411/EpiserverAPI_PostmanCollection/blob/main/ServiceAPI/ServiceAPI_Collections.json   For the detail steps: Copy the raw content to Postman: https://raw.githubusercontent.com/KhanhPham2411/EpiserverAPI_PostmanCollection/main/ServiceAPI/ServiceAPI_Collections.json   2. Get ServiceAPI NetCore Token   3. Post to Assets/Import Example media file: https://github.com/KhanhPham2411/EpiserverAPI_PostmanCollection/blob/main/ServiceAPI/01-CreateMediaWithBlob.zip 4. To verify your import is working, use that task id to get task log:      

Converting Visual Basic Code to Metatrader 4: A Comprehensive Guide with Examples

Introduction: Visual Basic (VB) is a popular programming language used for creating Windows applications. On the other hand, Metatrader 4 (MT4) is a widely used platform for online trading, which allows users to create custom trading algorithms using its proprietary language, MQL4. If you're a trader who has developed strategies using Visual Basic, you may want to convert your code to run on the Metatrader 4 platform. In this blog post, we will guide you through the Visual Basic code to MQL4 with detailed examples. Step by step: Step 1: Understand the differences between Visual Basic and MQL4 Before diving into the conversion process, it's crucial to understand the fundamental differences between Visual Basic and MQL4. 1. Syntax: Though both languages are relatively easy to learn, their syntax is quite different. Visual Basic uses English-like syntax, while MQL4 is more similar to the C++ programming language. 2. Platform-specific functions: While Visual Basic has a wide range ...

Enabling way to drag CMS pages into Commerce content

  We are missing a way to drag CMS pages into a piece of Commerce content. It is simply not possible to view the CMS page tree in the Commerce context. We have a workaround for Entry Content (go to the CMS editor mode, find and open Commerce content from asset pane and edit). But that does not work for Node Content, because nodes/folders cannot be edited in the asset pane. But for the better solution would be to allow viewing CMS page tree in the right-hand asset pane. In this way, we could find and drag in CMS content when viewing a piece of Commerce content. It would also make editing Commerce content in CMS, and CMS content in Commerce, completely equal. The workaround was to re-enable the site view within the commerce context with the following using EPiServer . Cms . Shell . UI . Components ; using EPiServer . Commerce . Shell ; using EPiServer . Shell . ViewComposition ; namespace Foundation . Custom {     [ Component ]     public class CustomPageTr...