asp.net-core-2.1

Customize Login Page design for Authentication type : Individual User account ASP.NET core 2.1, MVC, c#

Deadly 提交于 2019-12-12 07:06:58
问题 I'm trying to implement OAuth2.0 for my web application. I have done that following this link. I have registered with 2 external providers Microsoft and google. I have added Authentication in startup.cs file as well. So when I run the application, click on Login button on top right corner, a Login page is displayed.The URL it is showing is https://localhost:44325/Identity/Account/Login . But I'm unable to find this page anywhere in my solution. I want to modify this page's design and want to

Transaction Per Request Middleware Not working

南楼画角 提交于 2019-12-12 01:19:26
问题 I am trying to add a middleware so that transaction begins at the beginning of the request and commits or rollbacks depending on the situation. This is my middleware: public class TransactionPerRequestMiddleware { private readonly RequestDelegate next_; public TransactionPerRequestMiddleware(RequestDelegate next) { next_ = next; } public async Task Invoke(HttpContext context, AppDbContext dbContext) { var is_everything_ok = true; var transaction = dbContext.Database.BeginTransaction( System

Model normalization before model validation in Asp.Net Core 2.0+

人走茶凉 提交于 2019-12-11 17:40:06
问题 I'm using automatic model validation (see "Better Input Processing") to keep my controllers clean; so: [HttpPost] [ProducesResponseType(typeof(Product), 201)] public IActionResult Post([FromBody] Product product) { if (!ModelState.IsValid) { return BadRequest(ModelState); } product = _repository.AddProduct(product); return CreatedAtAction(nameof(Get), new { id = product.Id }, product); } becomes: [HttpPost] [ProducesResponseType(201)] public ActionResult<Product> Post(Product product) {

Is the best practice alwayas to start a dialog in bot?

六月ゝ 毕业季﹏ 提交于 2019-12-11 17:14:08
问题 I am migrating a bot V3 to V4 and it is working well, but the bot has some rules and I am having some difficulties to implement these rules. One of these rules starts dialog after call Luis, in this Luis recognizes the need. My doubt is: what is the best practice to bot? Always starts a dialog or only starts if necessary? PS: in my mind, I have to start if necessary, but I am in doubt. if (Luis.CheckDialogNeed) { await Dialog.RunAsync(turnContext, ConversationState.CreateProperty<DialogState>

HAA0502 Explicit new reference type allocation

≯℡__Kan透↙ 提交于 2019-12-11 16:08:54
问题 I have ASP.Net Core 2.1 , C# application. I am using Clr Heap Allocation Analyzer https://marketplace.visualstudio.com/items?itemName=MukulSabharwal.ClrHeapAllocationAnalyzer One of the methods looks as below Ex#1 public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IPocoDynamo>(serviceProvider => { var pocoDynamo = new PocoDynamo(serviceProvider.GetRequieredService<IAmazonDynamoDB>()); pocoDynamo.SomeMethod(); return pocoDynamo; }); } Ex.#2 public async Task

How to call dialog inside botframework v4 in net-core?

旧街凉风 提交于 2019-12-11 15:54:36
问题 I finally migrated a bot from v3 to v4 and it is working. It wouldn't be possible with out this community. Thank you all! Now I am trying to include dialog in my bot. I've read documentation and have studied samples in github (botframework v4 repository), in this case all samples always start with dialog. I don't need to start with dialogs because not all messages from the users require dialog. The most of messages from users call Luis and it is enough to unique response. The issue is: In

Unable to find the path to the view.cshtml file in the Razor Class Library(The Razor Class Library is .dll)

我的梦境 提交于 2019-12-11 15:42:26
问题 I'm currently working on an demo application of ASP.NET Core 2.1 . I try to use the new RCL ( Razor class Library ) in my ASP.NET Core MVC application. I have 2 projects in my Solution Project 1 : ASP.NET Core MVC application Project 2 : Razor Class Library(MVC) The structure of my Razor Class Library is very simple: Areas MyFeature Views Shared _Layout.cshtml ↓ This is the source code of _ViewStart.cshtml in the project 1 ( ASP.NET Core MVC application) @{ Layout = "/Areas/MyFeature/Views

Create custom route attribute in ASP.NET Core 2

点点圈 提交于 2019-12-11 12:56:47
问题 We have a bunch of endpoints where we'd like to do the exact same thing for each of them: Register them as a route and verify that the user has access to them. Very condensed our issue can be condensed to us having something like this: [HttpGet, Route(EntityId.First)] [HttpGet, Route(EntityId.Second)] [VerifyAccessFilter(EntityId.First, EntityId.Second)] public async Task<IActionResult> Endpoint() { return Ok(); } But would much rather like something like: [RouteAndVerify(EntityId.First,

Get the Domain or Host name and Port in Configure of Startup.cs

女生的网名这么多〃 提交于 2019-12-11 12:47:25
问题 I'm in need of help in getting the host/domain name and port of my application. So far, here's my sample code in my Configure method inside the Startup.cs : public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var url = ""; // something that will get the current host/domain and port of the running applicaiton. RecurringJob.AddOrUpdate<ISomething>(i=>i.SomethingToExecute(url), Cron.Daily); } Because I need to pass the url string to my SomethingToExecute method public class

Cannot access methods Newtonsoft.JSON .Net Core 2.*

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:01:50
问题 I'm have a solution with multiple projects all using .Net Core 2.1 (VS 2017). I can use Newtonsoft.JSON.JsonConvert in my web project without any problem for serializing and deserializing objects. Another project in the same solution has the same Nuget packages (version and SDK) as my web project. Intellisense recognizes JsonConverter, but the only method that shows is Equals, so no SerializeObject or DeserializeObject. When I open the JsonConvert Definition within my console application it