I have read about this issue on some previous thread, however it is still not working, I have commented all console.log and still not working.
I am using Angular 6, may Web API is in .NET Core.
Thanks in Advance!
I finally found the answer after googling and trying different methods. It may be a duplicated concern / issue, but I just want to share my experience doing a WebAPI using .Net Core.
I found out that my web app seems to disabled back and forward caching. (can be seen on Console F12 Dev Tools)
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
Add app.UseResponseCaching(); in Startup.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Use Cross origin resource sharing
app.UseCors(
options => options.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
);
app.UseAuthentication();
//20180830
app.UseResponseCaching();
app.UseMvc();
}
Add services.AddResponseCaching(); in Startup.cs, ConfigureServices.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddResponseCaching();
...............
}
Finally add a response header on my Web API solves the issue.
[HttpGet("usraccessbk"), ResponseCache(Location = ResponseCacheLocation.None,
NoStore = true)]
public IActionResult GetWorkXXXXAccess(string user, string buXXXX) {
...........
}