System.Web.HttpResponse.AddFileDependency C# (CSharp) Method

AddFileDependency() public method

public AddFileDependency ( string filename ) : void
filename string
return void
		public void AddFileDependency (string filename)
		{
			if (filename == null || filename == String.Empty)
				return;
			FileDependenciesArray.Add (filename);
		}

Usage Example

        internal static void ProcessRequestInternal(HttpContext context, string overrideVirtualPath)
        {
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;

            if (!ProcessRequestForNonMapPathBasedVirtualFile(request, response, overrideVirtualPath))
            {
                string path;
                string physicalPath;
                if (overrideVirtualPath == null)
                {
                    path         = request.Path;
                    physicalPath = request.PhysicalPath;
                }
                else
                {
                    path         = overrideVirtualPath;
                    physicalPath = request.MapPath(overrideVirtualPath);
                }
                FileInfo info         = GetFileInfo(path, physicalPath, response);
                DateTime lastModified = new DateTime(info.LastWriteTime.Year, info.LastWriteTime.Month, info.LastWriteTime.Day, info.LastWriteTime.Hour, info.LastWriteTime.Minute, info.LastWriteTime.Second, 0);
                DateTime now          = DateTime.Now;
                if (lastModified > now)
                {
                    lastModified = new DateTime(now.Ticks - (now.Ticks % 0x989680L));
                }
                string etag   = GenerateETag(context, lastModified, now);
                long   length = info.Length;
                string str4   = request.Headers["Range"];
                if (!StringUtil.StringStartsWithIgnoreCase(str4, "bytes") || !ProcessRangeRequest(context, physicalPath, length, str4, etag, lastModified))
                {
                    SendFile(physicalPath, 0L, length, length, context);
                    response.ContentType = MimeMapping.GetMimeMapping(physicalPath);
                    response.AppendHeader("Accept-Ranges", "bytes");
                    response.AddFileDependency(physicalPath);
                    response.Cache.SetIgnoreRangeRequests();
                    response.Cache.SetExpires(DateTime.Now.AddDays(1.0));
                    response.Cache.SetLastModified(lastModified);
                    response.Cache.SetETag(etag);
                    response.Cache.SetCacheability(HttpCacheability.Public);
                }
            }
        }
All Usage Examples Of System.Web.HttpResponse::AddFileDependency