2017-09-24 10 views
0

으로 설정하면 성공이 아닌 다양한 방법으로 시도됩니다. 나는 나의 헤더 인증 =ActionFilterAttribute .net core WebApi. 사용자 지정 응답 헤더를

enter image description here

결과 디버그, headers.Add 헤더 알 수없는 헤더를 변경하고 자바 스크립트를 얻고 싶은

enter image description here

나는 자바 스크립트를 얻을 수 없다 , 그가 헤더를 보내지 않았기 때문에, 헤더를 보내는 방법?

.net 코어 웹 api 2.0

답변

0

해결!

solved! // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 
    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 
    { 
     app.UseMiddleware(typeof(ErrorHandlingMiddleware)); 
     app.UseCors(b => b.AllowAnyHeader().WithExposedHeaders("Authorization").AllowAnyMethod().AllowAnyOrigin().AllowCredentials()); 
     app.UseMvc(); 

    } 

는 .WithExposedHeaders에게 ("인증")를 추가

들으