Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Adding default header (CACHE-CONTROL:NO-CACHE) for OWIN self host

$
0
0

I have a small C#, EXE which is used for grabbing sensor data. It uses Signalr to send the data. Then we found we wanted to also hold a few web pages for looking at the state of this server (it runs in a small box at a remote site) no big server, small footprint.

But we have issues with the OWI, Self-Host caching the web pages. How can tell the Self-Host to add headers to all HTML & JS requests to stop caching. e.g. CACHE-CONTROL:NO-CACHE

Here is what the current code is that sets it up:

(web pages are stored in the \Scopes folder.

  class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var hubConfiguration = new HubConfiguration();
            hubConfiguration.EnableDetailedErrors = (Tools.DebugLevel > 10);
            hubConfiguration.EnableJavaScriptProxies = true;
            app.UseCors(CorsOptions.AllowAll);
            //app.UseStaticFiles();
            app.UseFileServer(new FileServerOptions()
            {
                //RequestPath = new PathString("/Scopes"),
                EnableDirectoryBrowsing = true,
                FileSystem = new PhysicalFileSystem(@".\Scopes"),
            });
            app.MapSignalR("/signalr", hubConfiguration);
        }
    }


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>