Category "c++sharp"

New line character from c# to cshtml

I am making a webpage... the controller is written in C# and the webpage is in cshtml. In the c# file, I am constructing strings to be put into the table on the

Force MVC CookieAuthentication to timeout prematurely, then setup combination of sliding and absolute expiration

I am maintaining a website that using cookie authentication in a ASP.NET MVC5 application. When the application went live the cookie time out is set to a very l

Grab object values during runtime for creating Mock objects required for writing Unit Test

Consider the below class which needs to be tested, class ToBeTested { Employee _e; public ToBeTested(Employee e) { _e = e; } void Process() {

Optional section was not defined error in nested layout pages

I have a _Layout.cshtml file that contains the following line. @RenderSection("Scripts", required: false) And then I have a StorageLayout.cshtml file that spec

Entity Migration. Could not drop constraint. See previous errors

Here is the code that produce this error. I've tried solution for renaming the AddForeignKey but the error is same. 'PK_dbo.Item' is not a constraint. Co

System.ObjectDisposedException: 'Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope

I have an async controller and I am trying to call two different Async functions from it. like this public async void Approvefiles(string[] data) {

What's the VB.NET equivalent of async delegate in C#?

I'm trying to convert the following extension method (source) from C# to VB: public static Task ForEachAsync<T>(this IEnumerable<T> source,

WebView2 JS injection returns empty json string

With WebView2 for targeting Windows, I am trying to setup my own context menu. Either by selected text or by underlying element pointed by mouse click. However,

Can't get query parameter from HttpRequestData

I'm upgrading my code from .NET 3.0 to .NET 5.0, this changes the sintaxis quite a bit. In my previous code, which is a http request build in AZURE FUNCTIONS .N

send whatsapp messages using WhatsappAPI in c#

I have installed WhatsappAPI from NuGet package manager and tried to implement code but could not register my mobile number through WART (WhatsApp Registration

WPF Label Justify & Distribute Text

I have a Label just displaying a title. How can I justify the text? and how can I distribute the text? Can I use a label or do I have to use another control?

VSTO Outlook Add-in Move folders up and down

i have an outlook add-in in which a folder is selected.Now what i want is, i want to move the folder up and down using C#. Is there someone that can help me in

Converting Python struct.pack to C#

I'm converting some python code to C# and was successful so far, but there's this one part that I don't understand and is arguably the most important part as it

Handling Events from a Service running in a Task in an AKKA.NET actor

I'm using the Prism framework for my WPF application. I have a producer service that runs in a Task and raises a CompositePresentationEvent when a file is found

Content Dialog not showing up WINUI3

I'm trying to show a popup to edit a brand in my app but it doesn't show up. Function where I call the Dialog: private async Task EditBrandAsync(Brand brand) {

how to find mail that was send by MailItem.Display()

I have following requirement : Allow the user to drag & drop an email from outlook to a datagrid Prepare a reply mail, and show it so the user can review a

how to read local excel file using webapi?

public class ExcelParserController : ApiController { [HttpGet] public IEnumerable<string> Get(string templatePath) { ExcelParser excel

C# - Two-Factor Authentication (without ASP.NET Core Identity)

Is it possible to implement a two-factor authentication without use ASP.NET Core Identity? I have my own login table and everything works fine with login + pass

Edit fields of a configuration on another screen

I need help I want to edit a specific field that comes from another screen of a configuration. I've tried the way I know but it doesn't work. Could you tell me

Include all navigation properties using Reflection in generic repository using EF Core

I'm working on creating a generic repository for an EF Core project to avoid having to write CRUD for all models. A major roadblock I've hit is navigation prope