Skip to content

Instantly share code, notes, and snippets.

@undeadcat
Created March 6, 2017 13:34
Show Gist options
  • Save undeadcat/8fdabab6dc42d0a0d2c3805284c3a189 to your computer and use it in GitHub Desktop.
Save undeadcat/8fdabab6dc42d0a0d2c3805284c3a189 to your computer and use it in GitHub Desktop.
Compile aspx
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Web.Compilation;
namespace WebApp
{
public class Generator
{
public static void Main(string[] args)
{
var root = "C:\\dev\\WebForms\\WebForms";
var aspxFile = "about.aspx";
IDictionary dictionary = new Dictionary<string, string>();
var clientBuildManager = new ClientBuildManager("/", root);
var virtualPath = "/" + aspxFile;
var aspxContent = File.ReadAllText(Path.Combine(root, aspxFile));
var code = clientBuildManager.GenerateCode(virtualPath,
aspxContent,
out dictionary);
Console.WriteLine(code);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment