title: How do you take a C# script and make it output a html page?
body: <p>I normally code in PHP and Python, but in this case i have to make it in C#.</p>
  
  <p>I have this code, It works really good. It is a console application.</p>
  
  <p>But how can you make it to a C# .net so that is can put it on a IIS?</p>
  
  <p>Basicly instead of outputting it to a console, it should just write it to the browser.</p>
  
  <p>I have tried to search for C# Web, but could not find anything.</p>
  
  <p>Thanks for the help!</p>
  
  <pre><code>using System;
  using System.Net;
  using Independentsoft.Exchange;
  
  namespace Sample
  {
      class Program
      {
          static void Main(string[] args)
          {
              NetworkCredential credential = new NetworkCredential("username", "password");
              Service service = new Service("https://myserver/ews/Exchange.asmx", credential);
  
              try
              {
                  IsGreaterThanOrEqualTo restriction1 = new IsGreaterThanOrEqualTo(AppointmentPropertyPath.StartTime, DateTime.Today);
                  IsLessThanOrEqualTo restriction2 = new IsLessThanOrEqualTo(AppointmentPropertyPath.EndTime, DateTime.Today.AddDays(1));
                  And restriction3 = new And(restriction1, restriction2);
  
                  FindItemResponse response = service.FindItem(StandardFolder.Calendar, AppointmentPropertyPath.AllPropertyPaths, restriction3);
  
                  for (int i = 0; i &lt; response.Items.Count; i++)
                  {
                      if (response.Items[i] is Appointment)
                      {
                          Appointment appointment = (Appointment)response.Items[i];
  
                          Console.WriteLine("Subject = " + appointment.Subject);
                          Console.WriteLine("StartTime = " + appointment.StartTime);
                          Console.WriteLine("EndTime = " + appointment.EndTime);
                          Console.WriteLine("Body Preview = " + appointment.BodyPlainText);
                          Console.WriteLine("----------------------------------------------------------------");
                      }
                  }
  
                  Console.Read();
              }
              catch (ServiceRequestException ex)
              {
                  Console.WriteLine("Error: " + ex.Message);
                  Console.WriteLine("Error: " + ex.XmlMessage);
                  Console.Read();
              }
              catch (WebException ex)
              {
                  Console.WriteLine("Error: " + ex.Message);
                  Console.Read();
              }
          }
      }
  }
  </code></pre>
  
  <p>EDIT: I have tried to make it a asp.net page
  But it do not print anything to the screen.</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Plan.NBT.Final.Default" %&gt;
  
  &lt;%@ Import Namespace="System" %&gt;
  &lt;%@ Import Namespace="System.Net" %&gt;
  &lt;%@ Import Namespace="Independentsoft.Exchange" %&gt;
  
  &lt;%
      NetworkCredential credential = new NetworkCredential("tedy", "123456889");
      Service service = new Service("https://area51.com/EWS/exchange.asmx", credential);
  
      try
      {
          IsGreaterThanOrEqualTo restriction1 = new IsGreaterThanOrEqualTo(AppointmentPropertyPath.StartTime, DateTime.Today);
          IsLessThanOrEqualTo restriction2 = new IsLessThanOrEqualTo(AppointmentPropertyPath.EndTime, DateTime.Today.AddDays(1));
          And restriction3 = new And(restriction1, restriction2);
  
          FindItemResponse response = service.FindItem(StandardFolder.Calendar, AppointmentPropertyPath.AllPropertyPaths, restriction3);
  
          for (int i = 0; i &lt; response.Items.Count; i++)
          {
              if (response.Items[i] is Appointment)
              {
                  Appointment appointment = (Appointment)response.Items[i];
  
                  Response.Write("Subject = " + appointment.Subject);
                  Response.Write("StartTime = " + appointment.StartTime);
                  Response.Write("EndTime = " + appointment.EndTime);
                  Response.Write("Body Preview = " + appointment.BodyPlainText);
                  Response.Write("----------------------------------------------------------------");
              }
          }
  
      }
  
  
       %&gt;
  </code></pre>