<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.NET</title>
        <link>http://davidcrowell.com/category/6.aspx</link>
        <description>.NET</description>
        <language>en-US</language>
        <copyright>David Crowell</copyright>
        <managingEditor>dave@davidcrowell.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <item>
            <title>Getting Remote Content in ASP.NET From Behind a Proxy</title>
            <link>http://davidcrowell.com/archive/2008/05/01/getting-remote-content-in-asp.net-from-behind-a-proxy.aspx</link>
            <description>&lt;p&gt;I had a simple piece of code to grab an RSS feed from another site, and display it formatted the way I wanted.  I used caching, and it worked well &lt;strong&gt;on my develepment server.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When deploying to the client's server, it no longer worked.  I did some digging and found out that I'd have to use a proxy.  No big deal, just a few lines of code.  I really didn't like have to add code, and have a setting to disable it, or use a different proxy, or whatever.&lt;/p&gt;
&lt;p&gt;Then I discovered, I didn't need to change the code.  Everything in the System.Net namespace can be configured to use a proxy in the web.config file.  I just added these few lines:&lt;/p&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;       &amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515"&gt;system.net&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;              &amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515"&gt;defaultProxy&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;                     &amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515"&gt;proxy&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;                           &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red"&gt;usesystemdefault&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;"&lt;span style="COLOR: blue"&gt;False&lt;/span&gt;"&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;                           &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red"&gt;proxyaddress&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;"&lt;span style="COLOR: blue"&gt;http://theproxy&lt;/span&gt;"&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;                           &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red"&gt;bypassonlocal&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;"&lt;span style="COLOR: blue"&gt;True&lt;/span&gt;"&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;                     /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;              &amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515"&gt;defaultProxy&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;       &amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515"&gt;system.net&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt; &lt;/div&gt;&lt;img src="http://davidcrowell.com/aggbug/29.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>David Crowell</dc:creator>
            <guid>http://davidcrowell.com/archive/2008/05/01/getting-remote-content-in-asp.net-from-behind-a-proxy.aspx</guid>
            <pubDate>Fri, 02 May 2008 01:19:07 GMT</pubDate>
            <wfw:comment>http://davidcrowell.com/comments/29.aspx</wfw:comment>
            <comments>http://davidcrowell.com/archive/2008/05/01/getting-remote-content-in-asp.net-from-behind-a-proxy.aspx#feedback</comments>
            <wfw:commentRss>http://davidcrowell.com/comments/commentRss/29.aspx</wfw:commentRss>
        </item>
        <item>
            <title>jQuery, AJAX, and JSON</title>
            <link>http://davidcrowell.com/archive/2007/11/26/jquery-ajax-and-json.aspx</link>
            <description>I had to quickly get up to speed today on a project using &lt;a target="_blank" href="http://jquery.com/"&gt;jQuery&lt;/a&gt;, and &lt;a href="http://json.org/" target="_blank"&gt;JSON&lt;/a&gt;.  I used the &lt;a href="http://james.newtonking.com/pages/json-net.aspx" target="_blank"&gt;Json.NET&lt;/a&gt; library to serialize C# objects to JSON.  That part was extremely easy.  On the client end, jQuery has good support for JSON, but I had to dynamically create HTML form fields (mostly radio buttons) from javascript.&lt;br /&gt;
&lt;br /&gt;
I haven't done much with either JSON or jQuery, so it was nice to learn something new.&lt;img src="http://davidcrowell.com/aggbug/24.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>David Crowell</dc:creator>
            <guid>http://davidcrowell.com/archive/2007/11/26/jquery-ajax-and-json.aspx</guid>
            <pubDate>Tue, 27 Nov 2007 02:40:48 GMT</pubDate>
            <wfw:comment>http://davidcrowell.com/comments/24.aspx</wfw:comment>
            <comments>http://davidcrowell.com/archive/2007/11/26/jquery-ajax-and-json.aspx#feedback</comments>
            <wfw:commentRss>http://davidcrowell.com/comments/commentRss/24.aspx</wfw:commentRss>
        </item>
        <item>
            <title>The |DataDirectory| Macro</title>
            <link>http://davidcrowell.com/archive/2007/05/16/The-DataDirectory-Macro.aspx</link>
            <description>&lt;p&gt;I had read about the &lt;font face="Arial"&gt;|DataDirectory| macro for connection strings in the context of Sql Server Express Edition.  Imagine my surprise when I found out it works not only on the SqlClient managed provider, but the OleDb managed provider also.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;This greatly simplified the configuration of a new website I'm working on that uses an Access database. I know, I don't like Access on the web either, but it wasn't my decision, and it will generally have no more than one user at a time.&lt;/p&gt;
&lt;p&gt;Anyway, if you need to use an Access database in the App_Data folder on an ASP.NET 2.0 project, the following connection string will get you started:&lt;br /&gt;
&lt;span style="FONT-FAMILY: courier new"&gt;Provider=Microsoft.Jet.OLEDB.4.0;Data source=|DataDirectory|TheDatabase.mdb&lt;/span&gt;&lt;/p&gt;&lt;img src="http://davidcrowell.com/aggbug/14.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>David Crowell</dc:creator>
            <guid>http://davidcrowell.com/archive/2007/05/16/The-DataDirectory-Macro.aspx</guid>
            <pubDate>Wed, 16 May 2007 18:37:08 GMT</pubDate>
            <wfw:comment>http://davidcrowell.com/comments/14.aspx</wfw:comment>
            <comments>http://davidcrowell.com/archive/2007/05/16/The-DataDirectory-Macro.aspx#feedback</comments>
            <wfw:commentRss>http://davidcrowell.com/comments/commentRss/14.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ALT.NET</title>
            <link>http://davidcrowell.com/archive/2007/04/19/ALT.NET.aspx</link>
            <description>&lt;a target="_blank" href="http://laribee.com/blog/2007/04/10/altnet/"&gt;David Laribee&lt;/a&gt; wrote about "alternative" .NET development or ALT.NET. He believes in using the best tool for the job, whether is is from Microsoft, the open source community, or somewhere else. &lt;br /&gt;
&lt;br /&gt;
This struck a chord with me, because it's how I like to work. I am a little worried though. In the Microsoft development world, using the status quo (the Microsoft tools) is usually the expected way to do things. It is the mainstream. I'm worried that continuing to use alternative tools will hurt my career.&lt;img src="http://davidcrowell.com/aggbug/12.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>David Crowell</dc:creator>
            <guid>http://davidcrowell.com/archive/2007/04/19/ALT.NET.aspx</guid>
            <pubDate>Thu, 19 Apr 2007 15:16:31 GMT</pubDate>
            <wfw:comment>http://davidcrowell.com/comments/12.aspx</wfw:comment>
            <comments>http://davidcrowell.com/archive/2007/04/19/ALT.NET.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://davidcrowell.com/comments/commentRss/12.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Horrible Debugging for XmlSerialization</title>
            <link>http://davidcrowell.com/archive/2007/04/03/Horrible-Debugging-for-XmlSerialization.aspx</link>
            <description>I spent time today trying to track down a bug in the project I'm working on.  I'm deserializing custom classes from XML stored as resources.  It works great, except when you introduce a tiny typo.  I kept getting this completely useless error:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="TEXT-ALIGN: center"&gt;&lt;img height="197" alt="An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll - There was an error reflecting type" width="444" src="/images/davidcrowell_com/XmlHell.png" /&gt;&lt;br /&gt;
&lt;div style="TEXT-ALIGN: left"&gt; &lt;/div&gt;
&lt;div style="TEXT-ALIGN: left"&gt;Due to the way .NET handles XML serialization and deserialization  (creating a temporary assembly), there is no stack trace, and no clue of what went wrong.&lt;br /&gt;
&lt;br /&gt;
Although this can be caused be any number of issues, in my case, one of the fields of my class is another class.  I had improperly marked it with &lt;span style="FONT-FAMILY: Courier New"&gt;[XmlAttribute]&lt;/span&gt; instead of &lt;span style="FONT-FAMILY: Courier New"&gt;[XmlElement]&lt;/span&gt;.  &lt;br /&gt;
&lt;br /&gt;
It appears the only way to debug this is to comment out the fields of the class, and uncomment each one, until it breaks again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Sigh&amp;gt;... back to work...&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://davidcrowell.com/aggbug/11.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>David Crowell</dc:creator>
            <guid>http://davidcrowell.com/archive/2007/04/03/Horrible-Debugging-for-XmlSerialization.aspx</guid>
            <pubDate>Tue, 03 Apr 2007 19:41:37 GMT</pubDate>
            <wfw:comment>http://davidcrowell.com/comments/11.aspx</wfw:comment>
            <comments>http://davidcrowell.com/archive/2007/04/03/Horrible-Debugging-for-XmlSerialization.aspx#feedback</comments>
            <wfw:commentRss>http://davidcrowell.com/comments/commentRss/11.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Custom Configuration in .NET 2.0</title>
            <link>http://davidcrowell.com/archive/2007/03/13/Custom-Configuration-in-.NET-2.0.aspx</link>
            <description>I spent a little time trying to learn how to create my own custom configuration classes, figuring that would be better than using AppSettings everywhere.  I gave it up, deciding that it was too difficult, and that I'd look into it again later.&lt;br /&gt;
&lt;br /&gt;
Well, today I found &lt;a target="_blank" href="http://haacked.com"&gt;someone smarter than me&lt;/a&gt; &lt;a target="_blank" href="http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx"&gt;blogging about it&lt;/a&gt;, and it turns out I was going about all the wrong way.  I'll have to give this a try soon.&lt;img src="http://davidcrowell.com/aggbug/8.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>David Crowell</dc:creator>
            <guid>http://davidcrowell.com/archive/2007/03/13/Custom-Configuration-in-.NET-2.0.aspx</guid>
            <pubDate>Tue, 13 Mar 2007 12:55:46 GMT</pubDate>
            <wfw:comment>http://davidcrowell.com/comments/8.aspx</wfw:comment>
            <comments>http://davidcrowell.com/archive/2007/03/13/Custom-Configuration-in-.NET-2.0.aspx#feedback</comments>
            <wfw:commentRss>http://davidcrowell.com/comments/commentRss/8.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>