<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technical Jargon &#187; ASP.NET</title>
	<atom:link href="http://www.jeremyskinner.co.uk/category/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeremyskinner.co.uk</link>
	<description>Did you notice the information bar?</description>
	<lastBuildDate>Mon, 08 Mar 2010 20:17:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How not to write a web application: The SagePay .NET integration kit</title>
		<link>http://www.jeremyskinner.co.uk/2009/09/26/how-not-to-write-a-web-application-the-sagepay-net-integration-kit/</link>
		<comments>http://www.jeremyskinner.co.uk/2009/09/26/how-not-to-write-a-web-application-the-sagepay-net-integration-kit/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 17:54:51 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SagePay]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/?p=213</guid>
		<description><![CDATA[
At work, we provide a small online store that allows students to pay for their course notes as well as examination fees through our intranet. For the last 4 years, we&#8217;ve been using SagePay (formerly Protx) to provide this functionality.

However, requirements change and the time has come where we need to re-visit the online payments [...]]]></description>
			<content:encoded><![CDATA[<p>
At work, we provide a small online store that allows students to pay for their course notes as well as examination fees through our intranet. For the last 4 years, we&#8217;ve been using <a href="http://www.sagepay.com">SagePay</a> (formerly Protx) to provide this functionality.</p>
<p>
However, requirements change and the time has come where we need to re-visit the online payments section of our system. Since the system was initially written, we&#8217;ve moved from WebForms to ASP.NET MVC. As the changes that needed to be made to the online store are fairly significant, we decided to take the opportunity to move the front-end to an ASP.NET MVC application.</p>
<p>When it came time to test the part of the system that communicates with the SagePay servers I decided to make use of their &#8216;Simulator&#8217; service &#8211; a sandboxed environment that allows you to test the data that you send/receive from SagePay.</p>
<p>
The &#8217;simulator&#8217; requires the use of the latest version of the SagePay protocol. Unfortunately for us, we were still using version 2.22 but the simulator needed version 2.23. We were using the SagePay .NET integration kit &#8211; a .NET assembly that contains a collection of classes necessary to build and respond to the strangely-formatted HTTP Posts required by the SagePay protocol. So I went to the SagePay website to look for a new version of the integration kit that worked with the latest version of their protocol, only to find that this kit had been discontinued.
</p>
<p>
SagePay now offer a new &#8216;integration kit&#8217; that is substantially different from the old version. The new kit no longer consists of a nice set of classes encapsulated in a .NET assembly, but is instead a sample ASP.NET web site (note I said &#8220;web site&#8221; not &#8220;web application&#8221;). Upon downloading the new integration kit I was both shocked and irritated by what I found.
</p>
<p>
Firstly, the kit is only available in VB &#8211; despite being marketed as a &#8220;.NET integration kit&#8221;, it is really only a VB integration kit. No C# version available. It makes heavy use of VB-specific features (such as the backwards compatability functions in Microsoft.VisualBasic.dll) which makes it a pain to convert to C#.
</p>
<p>
Secondly, the instructions/comments that come with the kit are just plain wrong &#8211; in numerous places they make reference to a &#8220;Hashing component&#8221; that needs to be installed (with regsvr32!). This is a complete falsehood as the integration kit makes no use of this &#8220;hashing component&#8221; (the classic-ASP version of the kit does, but not the .NET version).
</p>
<p>
Thirdly, it is tightly coupled to both WebForms and MySql. This means in order to use it in our application we would need to 1) translate it to C#, 2) remove all the web-forms specific code and 3) convert it from using MySqlConnection objects over to the ORM we&#8217;re using. (Incidentally, why does a sample application like this need a MySql database? Isn&#8217;t an in memory collection good enough?)
</p>
<p>
Finally, the code contained in the project is riddled with bad practices. Concatenated SQL strings, custom encoding functions (rather than making use of what is in the framework) and everything takes place in the codebehind of the aspx pages. The OO nature of .NET seems to be completely ignored. This screenshot of one of the button click events sets the tone for the whole project:
</p>
<p><img alt="SagePay integration kit" src="/files/OnError.PNG" /></p>
<p>
I&#8217;d highly recommend checking out the rest of the code in the SagePay .NET integration kit. It is a great example of how not to build a web application with .NET. It can be downloaded <a href="http://www.sagepay.com/developers/downloads/integration_kits/server/ASPNET_Kit.zip">from the SagePay website.</a>
</p>
<p>
I get the impression that the developer who wrote the original .NET integration kit no longer works for SagePay as the new version appears to be written by someone who has very little understanding of .NET.
</p>
<p>
I posted my frustration <a href="http://twitter.com/JeremySkinner">on twitter</a> a few weeks ago and received a response from <a href="http://twitter.com/Joe_SagePay">Joe_SagePay</a>. I sent him a long email with some detailed feedback on this new integration kit which he said he would pass on to their development team in order for them to provide me with a response. Two and a half weeks later I&#8217;ve heard nothing else.
</p>
<p>
In the end, instead of trying to make sense of the messy code contained in the integration kit we decided to write our own implementation of the VSP Server protocol. This is now available <a href="http://github.com/JeremySkinner/SagePayMvc">as the SagePayMvc project on GitHub</a> and released under the Apache 2 license.
</p>
<p>
Tomorrow I&#8217;ll <a href="http://www.jeremyskinner.co.uk/2009/09/27/using-sagepay-with-asp-net-mvc/">write a more detailed post about the SagePayMvc library</a> and how it can be used inside an ASP.NET MVC application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2009/09/26/how-not-to-write-a-web-application-the-sagepay-net-integration-kit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ASP.NET Routing, DataBinding and WebForms</title>
		<link>http://www.jeremyskinner.co.uk/2008/06/21/aspnet-routing-databinding-and-webforms/</link>
		<comments>http://www.jeremyskinner.co.uk/2008/06/21/aspnet-routing-databinding-and-webforms/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 16:06:28 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://jeremyskinner.wordpress.com/?p=37</guid>
		<description><![CDATA[Update 13/09/08 I&#8217;ve posted a new version of the sample which is compatible with .NET 3.5 SP1. It can be found here.

One of the great things about ASP.NET MVC is the automatic databinding support for routing. For example, if you define a route like this:


routes.Add&#40;new Route&#40;&#34;{controller}/{action}/{id}&#34;, new MvcRouteHandler&#40;&#41;&#41; &#123;
	Defaults = new RouteValueDictionary&#40;new &#123; action = [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 13/09/08</strong> I&#8217;ve posted a new version of the sample which is compatible with .NET 3.5 SP1. <a href="/files/RoutingWithAutoBinding-v2.zip">It can be found here.</a></p>
<p>
One of the great things about ASP.NET MVC is the automatic databinding support for routing. For example, if you define a route like this:
</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">routes.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> Route<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{controller}/{action}/{id}&quot;</span>, <span style="color: #008000;">new</span> MvcRouteHandler<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	Defaults <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> RouteValueDictionary<span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> <span style="color: #000000;">&#123;</span> action <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Index&quot;</span>, id <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span><span style="color: #0600FF;">null</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>&#8230;and you have a controller like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> HomeController <span style="color: #008000;">:</span> Controller <span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> ActionResult Show<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> id<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-style: italic;">// do stuff</span>
		<span style="color: #0600FF;">return</span> View<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>
&#8230;then visiting a url like <strong>mysite.com/Home/Show/5</strong> will automatically popuate the id parameter of the Show action with the value 5.
</p>
<p>
I thought it would be fun to see if I could get something similar working using WebForms. It actually turned out to be quite straightforward.
</p>
<p>
First, you&#8217;ll need to set up ASP.NET Routing to work with WebForms. I&#8217;m using Phil Haack&#8217;s WebFormRouting library which can be found <a href="http://haacked.com/archive/2008/05/19/updated-routing-with-webforms.aspx">here</a>.
</p>
<p>
I&#8217;ve added an extension method to RouteCollection that allows me to declare routes like this:
</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">RouteTable.<span style="color: #0000FF;">Routes</span>.<span style="color: #0000FF;">MapWithAutoBinding</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Customer/{CustomerId}&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">To</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;~/Customer.aspx&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>
In the code behind file for my customer.aspx page I can now declare a property like this:
</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">partial</span> <span style="color: #FF0000;">class</span> Customer <span style="color: #008000;">:</span> Page <span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">void</span> Page_Load<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		customerNameLabel.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> CustomerId<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#91;</span>DataBind<span style="color: #000000;">&#93;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> CustomerId <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>
So when I visit MySite.com/Customer/Jeremy the &#8220;CustomerId&#8221; property on the Customer.aspx page will automatically be set to &#8220;Jeremy&#8221;.
</p>
<h2>How does it work?</h2>
<p>
Calling RouteTable.MapWithAutoBinding will create a route using the <strong>AutoBoundWebFormRouteHandler</strong> which inherits from Phil Haack&#8217;s WebFormRouteHandler. After GetHttpHandler is called, reflection is used to find any properties on the page that have a DataBindAttribute.
</p>
<p>
The RequestContext is then passed to the <strong>PerformBinding</strong> method on the DataBindAttribute, which will find the appropriate value from the RouteData and invoke the property&#8217;s setter.
</p>
<h2>Taking it a stage further: using Linq to Sql</h2>
<p>
Just for fun, I thought I&#8217;d see if it was possible to automatically fetch an entity from the database based on the value in the RouteData in a similar way to <a href="http://www.castleproject.org/monorail/documentation/trunk/integration/ar.html">Monorail&#8217;s ARDataBind attribute</a>. I thought I&#8217;d try and use Linq to SQL as I haven&#8217;t used this in a project before.
</p>
<p>
The first stage was to inherit from the DataBindAttribute class and override the PerformBinding method. Now, instead of just passing the value from the RouteData to the property, we have to run a linq query using the value from the route data as the primary key. This is very easy to do thanks to the Dynamic Linq provider that Microsoft ship in the Visual Studio 2008 samples folder.</p>
<p>
So, now the property on the Customer.aspx page can look like this:
</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>LinqBind<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CustomerId&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0600FF;">public</span> Customer Cust <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span></pre></div></div>

<p>
The &#8220;CustomerId&#8221; being passed into the LinqBind attribute tells the binder the name of the RouteData value it should use as the primary key for the Customer entity. Currently, this only works with single primary keys, although it should be possible to get it work with composite keys too.</p>
<p>Visiting <strong>mysite.com/customer/ALFKI</strong> will now run a linq query to load a customer from the Customers table using the customer id of &#8220;ALFKI&#8221; and then set the &#8220;Cust&#8221; property to be a reference to this entity.
</p>
<p>
It is also necessary to tell the LinqBindAttribute which DataContext should be used to do the fetching. This can be set in the Global.asax&#8217;s Application_Start method using a delegate:
</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">LinqBindAttribute.<span style="color: #0000FF;">DataContextFactory</span> <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">new</span> MyDataContext<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>
I&#8217;ve uploaded the code <a href="http://www.jeremyskinner.me.uk/files/RoutingWithAutoBinding-v2.zip">here</a> if anyone wants to play with it. </p>
<p>Disclaimer: The zip file contains Phil Haack&#8217;s WebFormRouting.dll and Microsoft&#8217;s Dynamic Linq provider from the Visual Studio 2008 samples.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2008/06/21/aspnet-routing-databinding-and-webforms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ConventionController Documentation</title>
		<link>http://www.jeremyskinner.co.uk/2008/01/19/conventioncontroller-documentation/</link>
		<comments>http://www.jeremyskinner.co.uk/2008/01/19/conventioncontroller-documentation/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 14:53:22 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[aspnetmvc]]></category>
		<category><![CDATA[mvccontrib]]></category>

		<guid isPermaLink="false">http://jeremyskinner.wordpress.com/2008/01/19/conventioncontroller-documentation/</guid>
		<description><![CDATA[I&#8217;ve just uploaded my first attempt at some documentation for the MVCContrib project&#8217;s ConventionController.

If anyone has any suggestions for improvement, or would like something else added, please let me know.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just uploaded my first attempt at some <a href="http://www.codeplex.com/MVCContrib/Wiki/View.aspx?title=ConventionController&amp;referringTitle=Documentation">documentation for the MVCContrib project&#8217;s ConventionController.</a></p>
<p>
If anyone has any suggestions for improvement, or would like something else added, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2008/01/19/conventioncontroller-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedded Resources with MonoRail Applications</title>
		<link>http://www.jeremyskinner.co.uk/2007/11/12/embedded-resources-with-monorail-applications/</link>
		<comments>http://www.jeremyskinner.co.uk/2007/11/12/embedded-resources-with-monorail-applications/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 11:36:33 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MonoRail]]></category>

		<guid isPermaLink="false">http://jeremyskinner.wordpress.com/2007/11/12/embedded-resources-with-monorail-applications/</guid>
		<description><![CDATA[I have a number of JavaScript files that I like to share amongst my web projects. Rather than keeping a separate copy of these script files in each application, I prefer to embed them in to an assembly that the various web projects can reference. But how do you reference these JavaScript files in your [...]]]></description>
			<content:encoded><![CDATA[<p>I have a number of JavaScript files that I like to share amongst my web projects. Rather than keeping a separate copy of these script files in each application, I prefer to embed them in to an assembly that the various web projects can reference. But how do you reference these JavaScript files in your HTML?</p>
<p>Using ASP.NET WebForms this is easy &#8211; you simply add a [assembly: WebResource] attribute to your AssemblyInfo.cs file and then you can call Page.ClientScript.GetWebResourceUrl to generate a URL to an HTTP Handler that will extract the resource from the assembly and output its contents (see <a href="http://aspnet.4guysfromrolla.com/articles/080906-1.aspx">this article</a> on 4guys for more information)</p>
<p>I wanted to do a similar thing using <a href="http://www.castleproject.org">MonoRail</a>, so I wrote a Controller and a Helper that perform a similar task.</p>
<p>The first thing I do is create a helper that will look up the names of all the embedded resources in the assembly. To do this, I use a static constructor to ensure that this only happens the first time that the class is used.</p>
<pre>
public class ScriptHelper : AbstractHelper
{
    internal const string ROOT_NAMESPACE = "Cristal.Common.Resources";
    private static readonly List&lt;string&gt; _resources = new List&lt;string&gt;();
    private static readonly string _version;

    static ScriptHelper()
    {
        _version = Assembly.GetExecutingAssembly().GetName().Version.ToString().Replace(".", "");
        foreach (string resource in typeof(ScriptHelper).Assembly.GetManifestResourceNames())
        {
            _resources.Add(resource);
        }
    }
}</pre>
<p>The static constructor finds all of the assembly-level resources and adds their names to a cache. I also look up the version of the currently executing assembly &#8211; more on this later. The constant ROOT_NAMESPACE variable simply stores the namespace where the embedded resources are stored.</p>
<p>Finally, I have a public method called &#8220;Install&#8221; that can be called from my Views to reference one of these embedded scripts:</p>
<pre>
public string Install(string name)
{
    NameValueCollection querystring = new NameValueCollection(2);
    querystring.Add("n", name); //name of script
    querystring.Add("v", _version); //version
    string url = Controller.UrlBuilder.BuildUrl(Controller.Context.UrlInfo,
                                                string.Empty,
                                                "Resources",
                                                "Scripts",
                                                querystring);

    //cut off the final ampersand which monorail irritatingly appends.
    url = url.Substring(0, url.Length - 1);
    url = HttpUtility.HtmlEncode(url);
    return string.Format("&lt;script type=\"text/javascript\" src=\"{0}\"&gt;&lt;/script&gt;", url);
}</pre>
<p>This method generates a URL to a pretend controller with the name of the script (and the assembly version) as querystring parameters. I can then declare this helper on my controller, and reference it in the view:</p>
<p>Controller:</p>
<pre>
[Helper(typeof(ScriptHelper), "Script")]
public class MyController : Controller
{
	public void Index() {}
}</pre>
<p>And the view:</p>
<pre>
${Script.Install("SomeScriptName")}</pre>
<p>Note that the name of the script is not the full web resource name (eg Cristal.Common.Resources.SomeScriptName.js)</p>
<p>In the HTML, this will generate some thing like:</p>
<pre>
&lt;script type="text/javascript" src="/Resources/Scripts.rails?n=SomeScriptName&amp;v=1000"&gt;&lt;/script&gt;</pre>
<p>The &#8220;n&#8221; querystring parameter is the name of the script and the &#8220;v&#8221; is the assembly version.<br />
Of course, this won&#8217;t actually work at the moment as there isn&#8217;t a Resources controller to handle the request. So let&#8217;s create one:</p>
<pre>
public class ResourcesController : Controller
{

    //n stands for "name", v stands for "version"
    [Cache(HttpCacheability.Public, Duration = 86400, VaryByParams = "v,n")]
    public void Scripts()
    {
    	if (Request.QueryString["n"] == null)
            throw new Exception("Invalid resource.");
	    Response.ContentType = "text/javascript";
        RenderText(ScriptHelper.GetResource(HttpUtility.HtmlEncode(Request.QueryString["n"])));
    }
}</pre>
<p>The &#8220;Scripts&#8221; action is very simple &#8211; it ensures that a script name is present in the query string, then passes it to the GetResource method on our scripthelper (below). Also notice the [Cache] attribute at the top of the action &#8211; once the script has been loaded from the assembly, the response is cached. However, to ensure that each script is cached separately, we specify the &#8220;n&#8221; query string parameter (the script name) in the VaryByParams option.</p>
<p>&#8220;v&#8221; is also in VaryByParams so that I can force the cache to expire by incrementing the version number.</p>
<p>Here&#8217;s the GetResource method on ScriptHelper:</p>
<pre>
internal static string GetResource(string name)
{
    name = BuildResourceName(name);

    string toReturn = string.Empty;
    if (name != null)
    {
     	Assembly asm = typeof(ScriptHelper).Assembly;
        using (StreamReader reader = new StreamReader(asm.GetManifestResourceStream(name)))
        {
        	toReturn = reader.ReadToEnd();
        }
    }
    return toReturn;
}

private static string BuildResourceName(string name)
{
    name = string.Format("{0}.{1}.js", ROOT_NAMESPACE, name);
    bool hasResource = false;
    foreach (string resource in _resources)
    {
    	if (name.Equals(resource, StringComparison.InvariantCultureIgnoreCase))
        {
            hasResource = true;
            name = resource;
            break;
        }
    }
    if (!hasResource)
    	return null;

    return name;
}</pre>
<p>Firstly, BuildResourceName is called to convert the script name (eg &#8220;SomeScriptName&#8221;) in to the fully qualified Web-resource name (eg &#8220;Cristal.Common.Resources.SomeScriptName.js&#8221;). Then, we use a streamreader to extract the contents of the JavaScript file from the embedded resource, convert it to a string and return it to the controller.</p>
<p>I&#8217;ve implemented this in the next version of CristalWeb (version 7).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2007/11/12/embedded-resources-with-monorail-applications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AJAX Control Toolkit Updated</title>
		<link>http://www.jeremyskinner.co.uk/2007/03/02/ajax-control-toolkit-updated/</link>
		<comments>http://www.jeremyskinner.co.uk/2007/03/02/ajax-control-toolkit-updated/#comments</comments>
		<pubDate>Fri, 02 Mar 2007 15:23:57 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://jeremyskinner.wordpress.com/2007/03/02/ajax-control-toolkit-updated/</guid>
		<description><![CDATA[Microsoft has released a new version of the AJAX Control Toolkit. As well as a number of bug fixes there are two new controls in this build: SlideShowExtender and ListSearchExtender.
The updated version can be downloaded from here
]]></description>
			<content:encoded><![CDATA[<p>Microsoft has released a new version of the AJAX Control Toolkit. As well as a number of bug fixes there are two new controls in this build: SlideShowExtender and ListSearchExtender.</p>
<p>The updated version can be downloaded from <a href="http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2007/03/02/ajax-control-toolkit-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
