asp.net-core-2.0

Angular 5: Post-request & windows authentication

隐身守侯 提交于 2020-02-06 23:48:49
问题 I need windows authentication in my project, but post-request is broken. I have a global implementation of HttpInterceptor. Cors enabled in my backend. services.AddCors(options => options.AddPolicy("AllowAllOrigin", builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().AllowCredentials())) When i send get-request i retrieve user identity in backend and it's alright. What's wrong with post-request? OPTIONS http://localhost:56789/api/document/GetDocuments 401 (Unauthorized)

ASP.NET Core Tag Helper Checkbox does not save unchecked value

帅比萌擦擦* 提交于 2020-02-05 02:33:26
问题 I'm adding a checkbox in an MVC form with Tag Helpers: <div class="form-group"> <label asp-for="@Model.Billable"></label> <input asp-for="@Model.Billable" type="checkbox" /> <input asp-for="@Model.Billable" type="hidden" /> </div> When the user changes the value to Checked from Unchecked, the form value passed back to the controller is True - perfect. However, if the value of the checkbox starts as Checked and the user changes it to Unchecked, the form value passed back to the controller is

C# dotnet core 2 pass data from middleware/filter to controller method

﹥>﹥吖頭↗ 提交于 2020-02-03 04:32:44
问题 currently we are writing a web application with dotnet core 2. We actually create some kind of multi-hosting platform where we can register new clients based on the url passed to our application. However currently we wanted to create a middleware/filter to validate our client's. Actually what we wanted to do is pull an object from the database and check if it exists, if yes, we want to call the controller method and make the object accessible, if it does not exist, we actually want to abort

How to enable CORS for a local file that references a hosted ASP.NET Web API that is hosted on Amazon AWS

做~自己de王妃 提交于 2020-02-02 14:10:11
问题 So when I open a file that references a hosted ASP.NET Web API 2.0 project, I get the error: Possible cross-origin (CORS) issue? The URL origin (https://secreturl.amazonaws.com) does not match the page (file://). Check the server returns the correct 'Access-Control-Allow-*' headers. I only get answers for enabling cores for an HTTP request pipeline but not for ( file:// ). I open the file from an index.html file, with path file:///C:/Users/PCName/desktop/index.html I assume the CORS have to

How to enable CORS for a local file that references a hosted ASP.NET Web API that is hosted on Amazon AWS

ぃ、小莉子 提交于 2020-02-02 14:09:30
问题 So when I open a file that references a hosted ASP.NET Web API 2.0 project, I get the error: Possible cross-origin (CORS) issue? The URL origin (https://secreturl.amazonaws.com) does not match the page (file://). Check the server returns the correct 'Access-Control-Allow-*' headers. I only get answers for enabling cores for an HTTP request pipeline but not for ( file:// ). I open the file from an index.html file, with path file:///C:/Users/PCName/desktop/index.html I assume the CORS have to

How to enable CORS for a local file that references a hosted ASP.NET Web API that is hosted on Amazon AWS

本小妞迷上赌 提交于 2020-02-02 14:08:46
问题 So when I open a file that references a hosted ASP.NET Web API 2.0 project, I get the error: Possible cross-origin (CORS) issue? The URL origin (https://secreturl.amazonaws.com) does not match the page (file://). Check the server returns the correct 'Access-Control-Allow-*' headers. I only get answers for enabling cores for an HTTP request pipeline but not for ( file:// ). I open the file from an index.html file, with path file:///C:/Users/PCName/desktop/index.html I assume the CORS have to

Cors error in Angular 6 .Net core 2.2 App

China☆狼群 提交于 2020-02-02 13:39:43
问题 I have developed the .Net Core MVC (angular) app and .net core Api app In both apps I have enabled the CORS in both Web app and api .Net Core services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); }); // in Configure app.UseCors("CorsPolicy"); Angular For all Get and Post add the headers like below get(url: string, options?: any) { let headers = new Headers(); headers.append('Content-Type',

Cors error in Angular 6 .Net core 2.2 App

丶灬走出姿态 提交于 2020-02-02 13:38:12
问题 I have developed the .Net Core MVC (angular) app and .net core Api app In both apps I have enabled the CORS in both Web app and api .Net Core services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); }); // in Configure app.UseCors("CorsPolicy"); Angular For all Get and Post add the headers like below get(url: string, options?: any) { let headers = new Headers(); headers.append('Content-Type',

Cannot run Dot net core preview project on Docker

时光总嘲笑我的痴心妄想 提交于 2020-01-30 04:36:51
问题 I have just created a web application with the latest .Net Core Preview sdks. I am trying to run it on Linux Docker however the project does not build. The error I am receiving is: Error The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.Creating network "dockercompose11433628216532645154_default" with the default driver Building testapppreview2 Service 'testapppreview2' failed to build: manifest for microsoft/aspnetcore:2.1 not found. My docker-compose.yml file version: '3

Asp.Net Core 2.0 on Azure results in a 502.5

烂漫一生 提交于 2020-01-29 03:18:06
问题 I have a small web app developed with Asp.Net Core 1.1 deployed on Azure and it works well. I just migrated the project to use Asp.Net Core 2.0 and tried to deploy it on Azure. The deployment went fine but when I open the site, I get a 502.5 error. When I check my Azure log stream, I get the following error: This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway was unable to send the request to a parent gateway. You may need to get a