From be0f5c764cf93fedb3a6ef9f4e5ad50e66039e27 Mon Sep 17 00:00:00 2001 From: shenbin Date: Wed, 20 May 2015 22:35:45 +0800 Subject: [PATCH] Add invariant culture when call ToString() in case non-English locale user will see invalid char exception raised when call Response.AddHeader() --- Unosquare.Labs.EmbedIO/Modules/StaticFilesModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Unosquare.Labs.EmbedIO/Modules/StaticFilesModule.cs b/Unosquare.Labs.EmbedIO/Modules/StaticFilesModule.cs index 5a6184c0c..069bcb439 100644 --- a/Unosquare.Labs.EmbedIO/Modules/StaticFilesModule.cs +++ b/Unosquare.Labs.EmbedIO/Modules/StaticFilesModule.cs @@ -1,6 +1,7 @@ namespace Unosquare.Labs.EmbedIO.Modules { using System; + using System.Globalization; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -217,7 +218,7 @@ private bool HandleGet(HttpListenerContext context, WebServer server, bool sendB } // check to see if the file was modified or etag is the same - var utcFileDateString = fileDate.ToUniversalTime().ToString(Constants.BrowserTimeFormat); + var utcFileDateString = fileDate.ToUniversalTime().ToString(Constants.BrowserTimeFormat, CultureInfo.InvariantCulture); if (eTagValid || context.RequestHeader(Constants.HeaderIfModifiedSince).Equals(utcFileDateString)) { context.Response.AddHeader(Constants.HeaderCacheControl, "private");