What does “Challenge” term stand for?

A ChallengeResult is an ActionResult that when executed, challenges the given authentication schemes’ handler. Or if none is specified, the default challenge scheme’s handler. Source code for ChallengeResult So for example, you can do: return Challenge(JwtBearerDefaults.AuthenticationScheme); //Can specify multiple schemes + parameters This will challenge the JWT Bearer authentication handler. In this handler’s case, it … Read more

Javascript in a View Component

What I decided to do is write a ScriptTagHelper that provides an attribute of “OnContentLoaded”. If true, then I wrap the inner contents of the script tag with a Javascript function to execute once the document is ready. This avoids the problem with the jQuery library having not loaded yet when the ViewComponent’s script fires. … Read more

Storing query results into a variable and modifying it inside a Stored Procedure

Yup, this is possible of course. Here are several examples. — one way to do this DECLARE @Cnt int SELECT @Cnt = COUNT(SomeColumn) FROM TableName GROUP BY SomeColumn — another way to do the same thing DECLARE @StreetName nvarchar(100) SET @StreetName = (SELECT Street_Name from Streets where Street_ID = 123) — Assign values to several … Read more

Is it possible to redirect request from middleware in .net core

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; namespace Test.Middleware { public class TestMiddleware { private readonly RequestDelegate _next; public TestMiddleware(RequestDelegate next) { _next = next; } public async Task InvokeAsync(HttpContext httpContext, AppDbContext dataContext, UserManager<User> userManager, IAntiforgery antiforgery) { // Redirect to login … Read more

Nested TagBuilder -as TagBuilderTree-

You can build the child elements in separate TagBuilders and put their generated HTML in the parent TagBuilder. Here’s an example: A <select> with some <option>s (example de-fatted for terseness) TagBuilder select = new TagBuilder(“select”); foreach (var language in languages) // never ye mind about languages { TagBuilder option = new TagBuilder(“option”); option.MergeAttribute(“value”, language.ID.ToString()); if … Read more

Html Agility Pack – Problem selecting subnode

A few things that will help you when working with HtmlAgilityPack and XPath expressions. If run is an HtmlNode, then: run.SelectNodes(“//div[@class=”date”]”) Will will behave exactly like doc.DocumentNode.SelectNodes(“//div[@class=”date”]”) run.SelectNodes(“./div[@class=”date”]”) Will give you all the <div> nodes that are children of run node. It won’t search deeper, only at the very next depth level. run.SelectNodes(“.//div[@class=”date”]”) Will return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)