Mega Code Archive

 
Categories / ASP.Net Tutorial / Development
 

Trigger Batch Compile

using System; using System.Net; using System.IO; using System.Text; class TriggerBatchCompile { private static string[] urls = { "http://localhost/page.aspx", "http://localhost/anotherApplication/page.aspx", "http://localhost/yetAnotherApplication/page.aspx" };     public static void Main(string[] args) {         WebResponse result = null;         for(int i = 0; i < urls.Length; i++) {             try {                 Console.WriteLine(urls[i]);                 WebRequest request = WebRequest.Create(urls[i]);                 result = request.GetResponse();                 Stream receiveStream = result.GetResponseStream();                 StreamReader streamReader = new StreamReader(receiveStream);                 char[] read = new Char[256];                 int count = streamReader.Read( read, 0, 256 );                 while (count > 0) {                     count = streamReader.Read(read, 0, 256);                 }             }             catch(Exception e) {                 Console.WriteLine(e);             }              finally {                 if ( result != null ) {                     result.Close();                 }             }         }     } }