<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Grant Barrington : Aspose</title><link>http://weblogs.asp.net/grantbarrington/archive/tags/Aspose/default.aspx</link><description>Tags: Aspose</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Using Reflection to Determine whether an Type is Nullable And Get the underlying Type</title><link>http://weblogs.asp.net/grantbarrington/archive/2009/03/17/using-reflection-to-determine-whether-an-type-is-nullable-and-get-the-underlying-type.aspx</link><pubDate>Mon, 16 Mar 2009 21:11:56 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6968518</guid><dc:creator>grant.barrington</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/grantbarrington/rsscomments.aspx?PostID=6968518</wfw:commentRss><comments>http://weblogs.asp.net/grantbarrington/archive/2009/03/17/using-reflection-to-determine-whether-an-type-is-nullable-and-get-the-underlying-type.aspx#comments</comments><description>&lt;p&gt;I've mentioned in a &lt;a href="http://weblogs.asp.net/grantbarrington/archive/2009/01/08/libraries-in-my-toolkit-another-lesson-in-partial-trust.aspx"&gt;previous post&lt;/a&gt; that we use Aspose.Words combined with Aspose.Pdf to create PDF documents/reports in all our applications. &lt;/p&gt;  &lt;p&gt;To do this we use a method within the Aspose.Words.Reporting.MailMerge class called &lt;a href="http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.reporting.mailmerge.executewithregions_overload_3.html"&gt;ExecuteWithRegions&lt;/a&gt; using the overload that passes in a DataTable. Within Aspose.Words this effectively loops through the fields in DataTable and creates what you'd normally refer to as a sub-report.&lt;/p&gt;  &lt;p&gt;Within our applications we use classes to represent our business objects. As we produce quite a few reports that rely on a number of different objects, we've created a helper method that turns our business objects and/or a List of business objects into DataTables.&lt;/p&gt;  &lt;p&gt;We came into a problem recently when one of our fields was defined as &amp;quot;int?&amp;quot; (same as Nullable&amp;lt;int&amp;gt;). The problem we had was trying to add a column on type &amp;quot;int?&amp;quot; to a DataTable. Make sense when you think about it... databases have had the concept of nullable fields for as long as I've been creating databases.&lt;/p&gt;  &lt;p&gt;Anyway... rather than add a field of type &amp;quot;int?&amp;quot; to the DataTable, I needed to add a field of type &amp;quot;int&amp;quot; as a column. Sounded simple... sort of... A fair bit of Googling and pulling together ideas from a couple of different blog posts led me to the following code.&lt;/p&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;p&gt;The code below takes a List of objects (simple... this doesn't handle complex types) and then returns a DataTable which is a representation of the object.&lt;/p&gt;  &lt;pre class="code" style="color: black"&gt;&lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
 /// &lt;/span&gt;&lt;span style="color: green"&gt;Converts a Generic List into a DataTable
 &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
 /// &amp;lt;param name=&amp;quot;list&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
 /// &amp;lt;param name=&amp;quot;typ&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
 /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
 &lt;/span&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataTable &lt;/span&gt;GetDataTable(&lt;span style="color: #2b91af"&gt;IList &lt;/span&gt;list, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;typ)
 {
     &lt;span style="color: #2b91af"&gt;DataTable &lt;/span&gt;dt = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataTable&lt;/span&gt;();

     &lt;span style="color: green"&gt;// Get a list of all the properties on the object
     &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PropertyInfo&lt;/span&gt;[] pi = typ.GetProperties();

     &lt;span style="color: green"&gt;// Loop through each property, and add it as a column to the datatable
     &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;PropertyInfo &lt;/span&gt;p &lt;span style="color: blue"&gt;in &lt;/span&gt;pi)
     {
         &lt;span style="color: green"&gt;// The the type of the property
         &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;columnType = p.PropertyType;

         &lt;span style="color: green"&gt;// We need to check whether the property is NULLABLE
         &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(p.PropertyType.IsGenericType &amp;amp;&amp;amp; p.PropertyType.GetGenericTypeDefinition() == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Nullable&lt;/span&gt;&amp;lt;&amp;gt;))
         {
             &lt;span style="color: green"&gt;// If it is NULLABLE, then get the underlying type. eg if &amp;quot;Nullable&amp;lt;int&amp;gt;&amp;quot; then this will return just &amp;quot;int&amp;quot;
             &lt;/span&gt;columnType = p.PropertyType.GetGenericArguments()[0];
         }

         &lt;span style="color: green"&gt;// Add the column definition to the datatable.
         &lt;/span&gt;dt.Columns.Add(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataColumn&lt;/span&gt;(p.Name, columnType));
     }

     &lt;span style="color: green"&gt;// For each object in the list, loop through and add the data to the datatable.
     &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;object &lt;/span&gt;obj &lt;span style="color: blue"&gt;in &lt;/span&gt;list)
     {
         &lt;span style="color: blue"&gt;object&lt;/span&gt;[] row = &lt;span style="color: blue"&gt;new object&lt;/span&gt;[pi.Length];
         &lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0;

         &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;PropertyInfo &lt;/span&gt;p &lt;span style="color: blue"&gt;in &lt;/span&gt;pi)
         {
             row[i++] = p.GetValue(obj, &lt;span style="color: blue"&gt;null&lt;/span&gt;);
         }

         dt.Rows.Add(row);
     }

     &lt;span style="color: blue"&gt;return &lt;/span&gt;dt;
 }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;The key points from the code above are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;using PropertyType.IsGenericType to determine whether the property is a generic type &lt;/li&gt;

  &lt;li&gt;using ProprtyType.GetGenericTypeDefinition() == typeof(Nullable&amp;lt;&amp;gt;) to test whether its a nullable type &lt;/li&gt;

  &lt;li&gt;getting the underlying type using PropertyType.GetGenericArguments() to get the base type. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To use the code above, you can do the following. The example below is a fairly contrived example, but it should highlight what I'm trying to do below.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Person
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public string &lt;/span&gt;Name { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime &lt;/span&gt;DateOfBirth { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;? DateOfDeath { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
}

&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Example
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataTable &lt;/span&gt;RunExample()
    {
        &lt;span style="color: #2b91af"&gt;Person &lt;/span&gt;edward = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Person&lt;/span&gt;() { Name = &lt;span style="color: #a31515"&gt;&amp;quot;Edward&amp;quot;&lt;/span&gt;, DateOfBirth = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;(1900, 1, 1), DateOfDeath = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;(1990, 10, 15) };
        &lt;span style="color: #2b91af"&gt;Person &lt;/span&gt;margaret = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Person&lt;/span&gt;() { Name = &lt;span style="color: #a31515"&gt;&amp;quot;Margaret&amp;quot;&lt;/span&gt;, DateOfBirth = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;(1950, 2, 9), DateOfDeath = &lt;span style="color: blue"&gt;null &lt;/span&gt;};
        &lt;span style="color: #2b91af"&gt;Person &lt;/span&gt;grant = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Person&lt;/span&gt;() { Name = &lt;span style="color: #a31515"&gt;&amp;quot;Grant&amp;quot;&lt;/span&gt;, DateOfBirth = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;(1975, 6, 13), DateOfDeath = &lt;span style="color: blue"&gt;null &lt;/span&gt;};

        &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Person&lt;/span&gt;&amp;gt; people = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Person&lt;/span&gt;&amp;gt;();

        people.Add(edward);
        people.Add(margaret);
        people.Add(grant);

        &lt;span style="color: #2b91af"&gt;DataTable &lt;/span&gt;dt = GetDataTable(people, &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Person&lt;/span&gt;));

        &lt;span style="color: blue"&gt;return &lt;/span&gt;dt;
    }
}&lt;/pre&gt;

&lt;p&gt;And this will return a DataTable that looks like the following (I'm an Aussie, so the date format is dd/MM/yyyy):&lt;/p&gt;

&lt;table cellspacing="0" cellpadding="2" width="713" border="0"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="236"&gt;&lt;strong&gt;Name (string)&lt;/strong&gt;&lt;/td&gt;

      &lt;td valign="top" width="228"&gt;&lt;strong&gt;DateOfBirth (DateTime)&lt;/strong&gt;&lt;/td&gt;

      &lt;td valign="top" width="246"&gt;&lt;strong&gt;DateOfDeath (DateTime)&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="236"&gt;Edward&lt;/td&gt;

      &lt;td valign="top" width="228"&gt;1/1/1900&lt;/td&gt;

      &lt;td valign="top" width="246"&gt;15/10/1990&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="235"&gt;Margaret&lt;/td&gt;

      &lt;td valign="top" width="228"&gt;9/2/1950&lt;/td&gt;

      &lt;td valign="top" width="246"&gt;[NULL]&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="235"&gt;Grant&lt;/td&gt;

      &lt;td valign="top" width="228"&gt;13/6/1975&lt;/td&gt;

      &lt;td valign="top" width="246"&gt;[NULL]&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;NOTE: as a general rule we try to NOT use nullable fields in the database, as nullable fields do some REALLY weird things to queries. Pretty much the only field types we use as nulls are DateTime fields. In my opinion, nullable fields get used far too often within databases and there is usually an alternative.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6968518" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/Aspose/default.aspx">Aspose</category><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/reflection/default.aspx">reflection</category></item><item><title>Libraries in my toolkit - Another lesson in Partial Trust</title><link>http://weblogs.asp.net/grantbarrington/archive/2009/01/08/libraries-in-my-toolkit-another-lesson-in-partial-trust.aspx</link><pubDate>Thu, 08 Jan 2009 09:03:40 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6826275</guid><dc:creator>grant.barrington</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/grantbarrington/rsscomments.aspx?PostID=6826275</wfw:commentRss><comments>http://weblogs.asp.net/grantbarrington/archive/2009/01/08/libraries-in-my-toolkit-another-lesson-in-partial-trust.aspx#comments</comments><description>&lt;h1&gt;&lt;/h1&gt;  &lt;h1&gt;Introduction&lt;/h1&gt;  &lt;p&gt;I compiled a list of the libraries we use day-to-day in my company. There are a couple of home-grown libraries, but most are commercially available, or open source.&lt;/p&gt;  &lt;p&gt;&amp;quot;Yeah great... another person telling us which libraries they use...&amp;quot;. I hear you all say... The reason I've done this is because nearly all our sites operate under a partial trust environment. To get some of these libraries working under partial trust I've done the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;I've recompiled them myself &lt;/li&gt;    &lt;li&gt;I've had to provide detailed instructions on how to replicate issues &lt;/li&gt;    &lt;li&gt;I've been told &amp;quot;BAD LUCK&amp;quot;, we're not going to bother getting our dll working, so find a new one. (This was my personal favourite) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All this and the only error you usually get is the dreaded &amp;quot;SecurityException&amp;quot; and an obfuscated stack trace.&lt;/p&gt;  &lt;p&gt;So, here they are... the libraries I use with great success.&lt;/p&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h1&gt;Libraries I Use&lt;/h1&gt;  &lt;h2&gt;BusyBoxDotNet&lt;/h2&gt;  &lt;p&gt;This library is used to display a modal popup when a long-running process is occurring.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="230" alt="image" src="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_thumb.png" width="456" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We use it for a couple of reasons:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;to let the user know they really did press that &amp;quot;FINISH&amp;quot; button&amp;#160; &lt;/li&gt;    &lt;li&gt;to stop the user from pressing that &amp;quot;FINISH&amp;quot; button again &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;This library relies on the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;ICSharpCode.SharpZipLib.dll &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To get this to work under partial trust, we needed to recompile both dll's.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sourceforge.net/projects/busybox"&gt;BusyBoxDotNet website&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Aspose.Words, Aspose.Pdf&lt;/h2&gt;  &lt;p&gt;These 2 libraries combined make up an AWESOME PDF generator. The ability to have one of our clients create their own report in Word using mail merge fields, and for us to deploy just a .doc file to a server is FANTASTIC.&lt;/p&gt;  &lt;p&gt;It took a little while for us to get this working under a partial trust environment. A couple of issues were logged with ASPOSE to rectify some things, but it all worked out in the end. This library is now working extremely well. Getting it working fast (less than 0.5 seconds per document) with Unicode characters and using all fonts (not just the default PDF fonts of Times and Courier) was an interesting exercise. I'll try to publish an article in the near future about how we got this working...&lt;/p&gt;  &lt;p&gt;Basically we can go from a Word document like this below...&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="116" alt="image" src="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_thumb_1.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;To a PDF document like this... &lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_6.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="102" alt="image" src="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_thumb_2.png" width="644" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.aspose.com"&gt;Aspose Website&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Aspose.Cells&lt;/h2&gt;  &lt;p&gt;This is a relatively new library for us and it does mostly what we need. There are a few things I've noticed about not running under partial trust. This is usually around setting and executing excel formulas in cells. Lucky for us, we use this mostly as a reporting tool and just dump tabular data into a spreadsheet.&lt;/p&gt;  &lt;h2&gt;iTextSharp&lt;/h2&gt;  &lt;p&gt;For more general PDF manipulation, we use iTextSharp. We use this library for the following (using a helper library we've created):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;joining 2 or more PDF files into 1 to email to a user (rather than making a user download 4 PDF files, we roll them all up into 1 PDF and send that to them instead.... it make it easier for them to print that way) &lt;/li&gt;    &lt;li&gt;watermarking an existing PDF &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can use iTextSharp to do PDF generation, but its extremely low-level. Given the amount of times end-users change their mind when it comes to documents generated from our systems, it was well worth the money to ASPOSE to allow users to create their documents in Word.&lt;/p&gt;  &lt;p&gt;To get iTextSharp working under partial trust, we had to sign and recompile the whole library (and a related library from memory)&lt;/p&gt;  &lt;h2&gt;Microsoft Enterprise Library&lt;/h2&gt;  &lt;p&gt;We just use the Data Access Layer functionality from EntLib version 3.1 (and probably just a really small portion of that). We run all our data access through stored procedures and usually return either DataSets or DataReaders (depending on what we need).&lt;/p&gt;  &lt;p&gt;To get this working under partial trust was a MAMMOTH effort. The compiled libraries didn't come signed or partially trusted... thus they didn't work. We had to recompile the whole enterprise library.    &lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; I think the compiled libraries available for download are now signed.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeplex.com/entlib"&gt;Enterprise Library website&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;NLog&lt;/h2&gt;  &lt;p&gt;NLog is a really good logging library. We've use it in every project we start now.&lt;/p&gt;  &lt;p&gt;We believe that when designing and writing applications, supportability is key.    &lt;br /&gt;When logging information we keep the following information:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;every stored procedure we run (including all the aspnet membership SPs). We re-wrote them to include logging. Basically every stored proc run logs to a table before it exits &lt;/li&gt;    &lt;li&gt;every page execution (who, when and how long it took to run). I do this as a page handler (I'll try to write about this in the future) &lt;/li&gt;    &lt;li&gt;any exception (we have a global error page that handles errors which logs and display a friendly error to the user) &lt;/li&gt;    &lt;li&gt;anything else we way think necessary to help with diagnosis or supportability. eg run-times of reports &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To get NLog working under partial trust required us to recompile the whole library from source. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.nlog-project.org/"&gt;Nlog Website&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;AJAX - AjaxControlToolKit, System.Web.Extensions&lt;/h2&gt;  &lt;p&gt;What web application could you start now without including AJAX somewhere in there???. For AJAX we use:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;System.Web.Extensions &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.codeplex.com/AjaxControlToolkit"&gt;AjaxControlToolkit&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.codeplex.com/mscui"&gt;NhsCui toolkit&lt;/a&gt; - We used this primarily for the &amp;quot;time picker&amp;quot; control. A very nice one... I like it. This was a pain to get working under partial trust though... In the file &amp;quot;CommonAssemblyInfo.cs&amp;quot; there is an attribute which requests full trust. In this web application this wasn't necessary, and works when you remove this attribute.       &lt;p&gt;[assembly: PermissionSet(SecurityAction.RequestMinimum, Name = &amp;quot;FullTrust&amp;quot;)]&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;NVelocity&lt;/h2&gt;  &lt;p&gt;We use NVelocity as our templating engine. Basically we use it as a mail-merge engine where we really just want either HTML or text as our output. We have wrapped a helper library around the standard NVelocity library as we don't use any of the functionality that reads templates from .vm files. We always pass in the template (usually stored in the DB) and our &amp;quot;merge fields&amp;quot; and retrieve the output from NVelocity.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.castleproject.org/others/nvelocity/index.html"&gt;NVelocity website&lt;/a&gt;&lt;/p&gt;  &lt;h1&gt;Home Grown Libraries we use for nearly every project&lt;/h1&gt;  &lt;p&gt;There are a couple of other home-grown libraries we use in almost every project.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;ForceSSL      &lt;br /&gt;&lt;/strong&gt;Running our applications on our hosting server, we can't get access to any IIS settings, specifically relating to SSL. Instead we have a HttpHandler that intercepts the page request, and redirects it to the same page, but using SSL.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Post Code Picker      &lt;br /&gt;&lt;/strong&gt;This control is similar to a Date Picker or Colour Picker. This control was written as a Extender using the AjaxControlToolkit and then turned into a composite user control. The user enters in the &amp;quot;Post Code&amp;quot; (Zip Code) and a list of available Suburbs (and States) appear retrieved from a web service.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_8.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="198" alt="image" src="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_thumb_3.png" width="366" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_10.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="51" alt="image" src="http://weblogs.asp.net/blogs/grantbarrington/WindowsLiveWriter/Librariesinmytoolkit_13727/image_thumb_4.png" width="304" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Convert RTF to text      &lt;br /&gt;&lt;/strong&gt;One of our applications requires us to interface with an application that stores data in a BLOB field formatted as Rich Text (RTF). We've written a convertor that takes the raw RTF data and converts it to raw text (removes all formatting codes etc.). I'll try to publish how we do this later as well.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;ABN Lookup helper      &lt;br /&gt;&lt;/strong&gt;The Australian Government allows us to access company records using a publicly exposed &lt;a href="http://www.abr.business.gov.au/content.aspx?page=XMLWebService"&gt;web service&lt;/a&gt;. In Australia (as with most countries I guess) each company has an ABN (Australian Business Number). This web service is great, as is stops duplicate records from being entered in applications we've written and verifies that the ABN that a client has given us is really theirs.&lt;/p&gt;  &lt;p&gt;We've written a helper wrapper around the web service and drop this into our applications as a library, rather than reference the web service directly in every application we write.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Payment Provider (Commerce Starter Kit)      &lt;br /&gt;&lt;/strong&gt;In quite a few of our applications we have to interface with a payment gateway to process credit card transactions. We've taken the Payment Gateway provider that came with the original Commerce Starter Kit and re-rolled it. This allows us to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;use the provider based model to connect to different gateways &lt;/li&gt;    &lt;li&gt;plug in a test gateway that approves all transactions (this is good for testing as most payment gateways use the cents value of the transaction to approve/decline a payment). eg 00 cents will pass, but 02 cents will return an error... Error number 02.. &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6826275" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/trust/default.aspx">trust</category><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/partial+trust/default.aspx">partial trust</category><category domain="http://weblogs.asp.net/grantbarrington/archive/tags/Aspose/default.aspx">Aspose</category></item></channel></rss>