public static IRenderingContext CreateChildContext( this IRenderingContext self, params string[] relativeDocumentPath ) { var childCtx = self.CreateChildContext(); var directory = self.DocumentUrlRoot != null ? self.DocumentUrlRoot : self.DocumentRoot; childCtx.DocumentUrl = OS.CombinePaths( new[] { directory }, relativeDocumentPath ); if ( !Directory.Exists( childCtx.DocumentUrlRoot ) ) { Directory.CreateDirectory( childCtx.DocumentUrlRoot ); } childCtx.Document = new StreamWriter( childCtx.DocumentUrl ); return childCtx; }
public static IRenderingContext CreateUniqChildContext( this IRenderingContext self ) { return self.CreateChildContext( Guid.NewGuid().ToString() + ".html" ); }