这可能是由于在开发环境中使用的浏览器与生产环境中的浏览器不同导致的。 您可以在启动文件中配置响应头来解决此问题:
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddMvc(); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Use(async (context, next) =>
{
context.Response.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate";
context.Response.Headers["Pragma"] = "no-cache";
context.Response.Headers["Expires"] = "0";
await next();
});
app.UseMvc();
}
}
这将在响应头中添加缓存控制标头,禁用浏览器的缓存。
此外,您可以使用以下代码禁用自动完成功能: