asp.net-core

ASP.NET Core 3.1 - Access denied

烈酒焚心 提交于 2021-02-11 13:50:23
问题 I'm quite new in ASP.NET Core 3.1 Razor Pages and I have a question. Hopefully you can help me further :). What I want to have is an application with Windows AD Security. Description of what I want to do: Customer needs to login using his/her AD account. The user is authorized if entered a valid AD account/password combination. The user have rights to see/adjust specific pages if in a specific group, let's say if in the Administrators group of the server where the application is running on.

ASP.NET Core 3.1 cannot process Axios request until ApiController attribute is added

橙三吉。 提交于 2021-02-11 13:47:46
问题 I have the following issue. Whenever I send something to my Api endpoint, ASP.NET Core 3.1 is not able to process the request. However, when I add the ApiController attribute it works perfectly fine. My code is correct but only works when I add this attribute. How is that so? For reference, here's my code API [ApiController] //Remove this and the code breaks [Route("api/SomeApi")] public class ApiController : Controller { private readonly IService service; public ApiController(IService

Accesing local server using Resharp

最后都变了- 提交于 2021-02-11 13:41:54
问题 I am in progress of implementing a searchView but before I do that I would like to successfully reach my local rest api (written using asp.net core). I found a package named RestSharp which seems to make consuming a rest api very simple. Right now I am stuck at accessing my api from my Xamarin.Android application. I am using a fragment which makes use of google maps, at the OnCreateView lifecycle method I am calling a addData which is supposed to reach out to my api: public override View

Getting error with aspnet core 2.1 action filter due to missing suitable constructor

◇◆丶佛笑我妖孽 提交于 2021-02-11 13:37:35
问题 I have made a claims filter public class ClaimRequirementAttribute : TypeFilterAttribute { public ClaimRequirementAttribute(string claimType, ClaimRoles claimValue) : base(typeof(ClaimRequirementFilter)) { Arguments = new object[] {new Claim(claimType, claimValue.ToString()) }; } } public class ClaimRequirementFilter : IAuthorizationFilter { public void OnAuthorization(AuthorizationFilterContext context) { var headers = context.HttpContext.Request.Headers; var tokenSuccess = headers

Jquery Ajax call passed parameter always null in Asp.net MVC Core

那年仲夏 提交于 2021-02-11 13:28:55
问题 I am migrating my MVC application to Asp.Net core (3.1 version) application. I have one layout page which is used for menu navigation. When user click on any menu then i need to pass some value from Layout to the controller for some business purpose. To do that i used one ajax call here. Below ajax call code is working fine in MVC, But in Asp.Net core the passed parameter value is null in controller. Working code of MVC: function SetCurrentPageNameSession(currentPageName, isBookMarkPage) { if

asp.net core 2.1 Odata How to omit “@odata.type” in response

[亡魂溺海] 提交于 2021-02-11 13:24:50
问题 I need help to remove from my response the odata type "@odata.type". I read in Odata documentation The odata.type annotation MUST appear if the type cannot be heuristically determined, as described below, and one of the following is true: · The type is derived from the type specified for the (collection of) entities or (collection of) complex type instances, or · The type is for a property whose type is not declared in $metadata. but I cannot figure out how to do it. { "@odata.context":

What Is The Correct Way of Closing / Disconnecting An ASP.NET Core signalR Client Connection?

梦想与她 提交于 2021-02-11 13:12:49
问题 I am a new user struggling to close a secondary signalR client gracefully from an ASP.NET Core Blazor Server Page. I am setting up a secondary signalR client connection on first render of a Blazor Server Page. I am trying to close this secondary signalR client connection when the Page is closed via the browser tab. At the time of writing DisposeAsync does not seem to be triggered when the page is closed via the browser tab. However, the Dispose method IS triggered. Furthermore in Safari 13.0

What Is The Correct Way of Closing / Disconnecting An ASP.NET Core signalR Client Connection?

安稳与你 提交于 2021-02-11 13:12:16
问题 I am a new user struggling to close a secondary signalR client gracefully from an ASP.NET Core Blazor Server Page. I am setting up a secondary signalR client connection on first render of a Blazor Server Page. I am trying to close this secondary signalR client connection when the Page is closed via the browser tab. At the time of writing DisposeAsync does not seem to be triggered when the page is closed via the browser tab. However, the Dispose method IS triggered. Furthermore in Safari 13.0

What Is The Correct Way of Closing / Disconnecting An ASP.NET Core signalR Client Connection?

≯℡__Kan透↙ 提交于 2021-02-11 13:12:06
问题 I am a new user struggling to close a secondary signalR client gracefully from an ASP.NET Core Blazor Server Page. I am setting up a secondary signalR client connection on first render of a Blazor Server Page. I am trying to close this secondary signalR client connection when the Page is closed via the browser tab. At the time of writing DisposeAsync does not seem to be triggered when the page is closed via the browser tab. However, the Dispose method IS triggered. Furthermore in Safari 13.0

How to resolve generic interface to generic implementation when using dependency injection?

元气小坏坏 提交于 2021-02-11 13:01:53
问题 I have created a generic repository that I want to be used in a service. public abstract class AbstractBaseRepository<TEntity, TEntityKey> : IBaseRepository<TEntity, TEntityKey> where TEntity : class, IBaseEntity<TEntityKey>, new() { /* some code */ } And the interface: public interface IBaseRepository<TEntity, TEntityKey> { /* some code */ } On my service I inject the repository like this: public class TenantsService : AbstractBaseService<TenantEntity, int> { public TenantsService