Questions tagged [ASP.NET] (1735)

0
answer

How to wrap responses in web Api .Net Core, so that in the case without error receive data, and errors information about the error?

The crux of the matter is that now I return IActionResult in his methods For example: // GET /api/Person [HttpGet] public async Task<ActionResult<IEnumerable<PersonDTO>>> GetAllPersons() { var persons = await personService.GetAllPersons(); logger.LogInformation("Successfully returned all persons"); ret...
Nickolas asked April 19th 20 at 12:39
1
answer

How to implement your mapping of objects in ASP NET MVC CORE?

This question I was told that Automapper it is better not to use How then to be with my implementation of the mapper without displaying c# Toist I need for each DTOшки for each VIewModel to use and create your own mapper class? For example there public class RoleMapperUpdateModel : IMapper<RoleDTO, UpdateRoleViewModel>...
Carson asked April 19th 20 at 12:20
1
answer

How do I filter the data in the app asp.net core mvc?

Hello! I'm developing an online store on ASP.NET CORE MVC. Use the site metanit. Experience development a little . When loading the main page, I can see the cards of all the goods, and about how on this page https://metanit.com/sharp/aspnet5/8.2.php On the form I have four drop down list, the data source which - category. W...
Vida_Kshler asked April 19th 20 at 12:19
0
answer

Why does not the authorization ASP.NET Core?

Want to do authorization by roles as here. In the controller AdminController [Authorize(Roles = "admin")] public IActionResult Index() { return View(); } after login throws back to the Login page, authorization. If you remove the [Authorize(Roles = "admin")] it runs the Index action of the controller AdminController. Wh...
Rosalind5 asked April 19th 20 at 12:01
0
answer

How to display data from table (many to many) in checkbox ASP Bootstrap?

Task. There is a database - two tables of Treatment and Responsible, the relationship is many-to-many. It is necessary in the editing window Applications display data from Responsible in the form of a checkbox, so that those who are already under a treatment selected was placed with a tick, and the rest of the data from the...
Norbert_Emmerich0 asked April 18th 20 at 13:40
2
answers

How to read files on the hosting asp.net?

Welcome! I have a website asp.net hosting. Also for hosting I uploaded single file file.txt. I need to read this file. How can I do it? As much as I tried to implement it did not, I was not able to specify the directory where the desired file is located. In the Internet found nothing.
marge.Christians asked April 18th 20 at 13:34
0
answer

What am I doing wrong in the POST processor for telegramBot?

Good day! struggling with the POST processing for many hours and can't figure out what could be the problem. asp.net core 3.1 [HttpPost] public async Task<OkResult> Post([FromBody]Update update) { if (update == null) return Ok(); var commands = Bot.Commands; var message = update.Message; var botClient = await...
zora38 asked April 18th 20 at 13:23
1
answer

Whether chhtml pages use tags and if they have a Layout, but I want to add additional style?

Whether chhtml pages use tags and if they have a Layout, but I want to add additional css style?
Tyshawn asked April 18th 20 at 13:19
1
answer

How to use web api in a major project Asp net mvc core?

For example how to get data from database using web api controllers with representation in the main project? Same thing for example, I can use the web api project to wallacii token-based in the main project with mvc?
neal asked April 18th 20 at 13:15
1
answer

How to make your validation token?

Hello! Trying to make a custom validatio token, but nothing comes out. I want to add to the validation algorithm of token verification on a blacklist. public void ConfigureServices(IServiceCollection services) { services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .All...
Rowland_Daugherty asked April 18th 20 at 13:09