2010-06-30 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web / StaticFileHandler.cs
index 2ed20085e1aa2fff055b2e66aa30ec42e04542c6..822cd68a735e8a6a4c37a687aba7e5c288ce856f 100644 (file)
@@ -5,6 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003-2009 Novell, Inc (http://novell.com)
 //
 
 //
@@ -38,17 +39,9 @@ namespace System.Web
 {
        class StaticFileHandler : IHttpHandler
        {
-               static bool runningWindows = RunningOnWindows ();
-
-               static bool RunningOnWindows ()
-               {
-                       int pid = (int)Environment.OSVersion.Platform;
-                       return (pid != 4 && pid != 128);
-               }
-
                static bool ValidFileName (string fileName)
                {
-                       if (!runningWindows)
+                       if (!RuntimeHelpers.RunningOnWindows)
                                return true;
 
                        if (fileName == null || fileName.Length == 0)
@@ -62,7 +55,6 @@ namespace System.Web
                        HttpRequest request = context.Request;
                        HttpResponse response = context.Response;
 
-#if NET_2_0
                        if (HostingEnvironment.HaveCustomVPP) {
                                VirtualFile vf = null;
                                VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
@@ -75,10 +67,9 @@ namespace System.Web
                                        throw new HttpException (404, "Path '" + vpath + "' was not found.", vpath);
 
                                response.ContentType = MimeTypes.GetMimeType (vpath);
-                               response.TransmitFile (vf);
+                               response.TransmitFile (vf, true);
                                return;
                        }
-#endif
                        
                        string fileName = request.PhysicalPath;
                        FileInfo fi = new FileInfo (fileName);