All Posts

Page 1

Posts

  • Getting logged in user ID in non-controller class in ASP.Net Core

    It’s easy to retrieve the current logged-in user’s information, such as user ID, username, or email, in an ASP.Net Core controller class. However, it can be tricky to access this information in other classes, like the IdentityDbContext class. Here’s an example of how to extract the current user in a non-controller class, specifically in the…

  • Fixing Azure Static App Error while Deploying Next.js

    If you encounter the following error while deploying your Next.js app to Azure Static App via a GitHub CD/CI pipeline: Don’t worry, it’s a quick fix! You just need to add one line to your package.json file: After adding this line, your package.json file should look something like this: Happy coding 🙂

  • Setting Environment Variables in Developer PowerShell in Visual Studio

    While writing UI automated test scenarios using Gherkin SpecFlow framework and C# Steps, I needed to set an environment variable to run a single test case from the command line. In the Windows Command Prompt, I would set the environment variable like this: For example: Then, I would run the test scenario using: However, setting…

  • Revert a check-in file in Git

    To revert a file to a previous version in Git, follow these steps: This will display a concise list of commits that have modified the file. 2. Checkout the previous version of the file: Use the git checkout command followed by the commit hash and the file name: Replace <commit_hash> with the hash of the…

  • Git Rebase Interactive: A Step-by-Step Guide

    Git Rebase Interactive is a powerful tool for rewriting commit history. Here’s how to use it: Step 1: Rebase the Branch Step 2: Edit the Commit History Step 3: Save and Close Save and close the interactive shell. Git will rebase the branch according to your changes. Step 4: Push the Updated Branch Example Output…

  • Code sign using PowerShell

    Code signing is important before releasing our software to the client. In the previous post, we use a PowerShell script to publish our code. After publishing the code, we need to sign the code before release. We must have code cert for signing. Install the code sign in your machine. Certificate installs process is simple…

  • .Net Publish Using PowerShell

    Sometimes we want to publish project using PowerShell rather then using Visual Studio Publish feature. I wanted to published all projects of the solutions in one folder. Below PowerShell command will published our projects in __DEPLOY__ folder as an example. Save this code as PowerShell script with extension of ps1. Run this script from VS,…

  • Git clone repo with specific branch

    Git clone command clones the default or master repository from git remote source. If need to clone a specific branch, we need to specify the branch name in the git clone command. Here is the command to do so Or we can write the same command as follows Hope this helps. Happy Coding 🙂

  • Folder rename in Git

    Git can’t detect directory name change. For example rename an existing folder to “Dashboard” from “DashBoard”. Even if we rename the folder name from the directory but git will still not detect the change. Here is the git command to make it work for rename For the above example it will not work since it’s…

  • Extract year from database date in C#

    In one of my projects, I was needed to extract a year from a database query and use it at a later stage in the program. I had to declare a nullable Datetime variable and assign the value from the database in a loop. Database query result need to assign in expiryDate variable The date…