<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Geek Freeq&#187; Web Development Archives  | Geek Freeq</title>
	<atom:link href="http://www.geekfreeq.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekfreeq.com</link>
	<description></description>
	<lastBuildDate>Thu, 10 Jun 2010 17:46:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SecuritySwitch Grows Up on Google Code</title>
		<link>http://www.geekfreeq.com/securityswitch-grows-google-code/</link>
		<comments>http://www.geekfreeq.com/securityswitch-grows-google-code/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 03:16:10 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://www.geekfreeq.com/?p=465</guid>
		<description><![CDATA[Edit: Due to a trademark infringement, this open source project will now  be named SecuritySwitch. What a huge PITA it was to migrate to a new project on Google Code! Since you cannot rename a project, I had to create a new one and move everything over to it. I so enjoyed blowing 2 [...]]]></description>
			<content:encoded><![CDATA[<div class="edit"><strong>Edit</strong>: Due to a trademark infringement, this open source project will now  be named SecuritySwitch. What a huge PITA it was to migrate to a new project on Google Code! Since you cannot rename a project, I had to create a new one and move everything over to it. I so enjoyed blowing 2 hours of my day off on Good Friday.</div>
<p>I recently <a href="/webpagesecurity-becomes-secureswitch/">posted about an update to my WebPageSecurity module</a> project to the newly named <em>SecuritySwitch</em>. One of the best ways to ramp up coding on the project again is to get it into a public code repository.</p>
<h3>Get with Git?</h3>
<p>I thought about using <a href="http://git-scm.com/" target="_blank">Git</a> on <a href="http://github.com/" target="_blank">GitHub</a>, but I want to get moving on this and that would not be the case if I had to fumble through learning Git now. Although, I do really like the concept of a <a href="http://en.wikipedia.org/wiki/Distributed_revision_control" target="_blank">distributed version control system (DVCS)</a>. Instead, I will stick with <a href="http://subversion.apache.org/" target="_blank">Subversion (SVN)</a> for now.</p>
<h3>Google Code</h3>
<p>That lands the project in the capable arms of <a href="http://code.google.com/" target="_blank">Google Code</a>, which I find to be a very nice <a href="http://code.google.com/p/securityswitch/" target="_blank">new home for SecuritySwitch</a>. I will likely have a dedicated page here on GeekFreeq for SecuritySwitch that refers visitors to the project on Google Code, and/or I will just pipe updates from the project site here via RSS.</p>
<p>Anyway, this is the first stage of a &#8220;grown-up&#8221; SecuritySwitch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/securityswitch-grows-google-code/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WebPageSecurity becomes SecuritySwitch</title>
		<link>http://www.geekfreeq.com/webpagesecurity-becomes-securityswitch/</link>
		<comments>http://www.geekfreeq.com/webpagesecurity-becomes-securityswitch/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 23:13:40 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://www.geekfreeq.com/?p=463</guid>
		<description><![CDATA[Edit: Due to a trademark infringement, this open source project will now be named SecuritySwitch. Feel free to read the comment posted by the holder of the trademark on the name I originally planned to use. It was a polite enough message. I think there may be ground for me to stand on with the [...]]]></description>
			<content:encoded><![CDATA[<div class="edit"><strong>Edit</strong>: Due to a trademark infringement, this open source project will now be named SecuritySwitch. Feel free to read the comment posted by the holder of the trademark on the name I originally planned to use. It was a polite enough message. I think there may be ground for me to stand on with the first name, but I don&#8217;t care to go to court over the name of a project that is free for anyone to download.</div>
<p>After a bit of a struggle supporting my <a href="http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx" target="_blank">WebPageSecurity module</a> on Code Project, I&#8217;ve decided to put some quality effort into the project in the very near future. One of the first things that needed attention was the name.</p>
<h3>What&#8217;s in a Name?</h3>
<p>Could I have named it something more generic all those years ago? Perhaps, but not likely. After a few minutes of running through some of the key nouns and verbs that describe the project&#8217;s purpose, it will now be known as <em>SecuritySwitch</em>.</p>
<h3>Educational Value vs. Quality Functionality</h3>
<p>Another change to the project will be the maintenance of the dual source code languages. Since I originally started the module, a distinct project for C# and VB.NET have been maintained. While this was great for the educational aspect of the article and accompanying code, it is not ideal for a quality &#8220;product&#8221;.</p>
<p>After some consideration, I decided to drop the VB.NET version of the source code in favor of a single project written in C#. An immediate benefit to the community of this decision is faster releases.</p>
<h3>What&#8217;s Next?</h3>
<p>All of this change should be balanced with something to make it all worth while. I intend on stopping development on the 2.x version of the module for .NET 1.1 where it is now. Of course, I&#8217;ll fix any bugs, but no new features will likely be added. Version 3.x for .NET 2.0 will continue until version 4.0. That&#8217;s when I will add some of the new features in the queue and enable full support for ASP.NET MVC as well.</p>
<p>Keep checking back for more progress on this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/webpagesecurity-becomes-securityswitch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ASP.NET &#8220;Remember Me&#8221; Option with Forms Authentication Not Working?</title>
		<link>http://www.geekfreeq.com/aspnet-remember-me-option-forms-authentication-not-working/</link>
		<comments>http://www.geekfreeq.com/aspnet-remember-me-option-forms-authentication-not-working/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 17:23:48 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.geekfreeq.com/?p=457</guid>
		<description><![CDATA[So, you&#8217;ve set the timeout value for forms authentication to a fairly large value, yet checking the &#8220;remember me&#8221; check box on the Login control still does not persist your users&#8217; authentication, even after a fairly short period of inactivity.
&#60;system.web&#62;
    ...
    &#60;authentication mode="Forms"&#62;
        &#60;forms timeout="10080"/&#62;
    &#60;/authentication&#62;
    ...
&#60;/system.web&#62;
Don&#8217;t spend hours [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 208px"><img title="ASP.NET Login Control" src="http://farm3.static.flickr.com/2493/4025759133_b6c35381b3_o.png" alt="ASP.NET Login Control" width="198" height="108" /><p class="wp-caption-text">ASP.NET Login Control</p></div>
<p>So, you&#8217;ve set the <em>timeout </em>value for forms authentication to a fairly large value, yet checking the &#8220;remember me&#8221; check box on the Login control still does not persist your users&#8217; authentication, even after a fairly short period of inactivity.</p>
<pre class="xml">&lt;system.web&gt;
    ...
    &lt;authentication mode="Forms"&gt;
        &lt;forms timeout="10080"/&gt;
    &lt;/authentication&gt;
    ...
&lt;/system.web&gt;</pre>
<p>Don&#8217;t spend hours trying to figure out why this, <em>seemingly</em>, basic functionality doesn&#8217;t perform as it should. The solution to this problem is very simple, albeit somewhat obscure.</p>
<p><span id="more-457"></span></p>
<h3>Encryption is the Key</h3>
<p>To make the &#8220;remember me&#8221; check box actually obey your users when they check it, you need to ensure that a static <strong>machine key</strong> is added to your website&#8217;s web.config file. That&#8217;s it! <strong>Really.</strong></p>
<pre class="xml">&lt;system.web&gt;
    ...
    &lt;machineKey
        validationKey="xxxxxxxxx"
        decryptionKey="xxx"
        validation="SHA1" decryption="AES"/&gt;
    ...
&lt;/system.web&gt;</pre>
<h4>Generate Random Keys</h4>
<p>Generate your own keys by using <a href="http://www.developmentnow.com/articles/machinekey_generator.aspx" target="_blank">one of the machineKey generator websites</a> available. After using a generator, copy and paste the <em>machineKey </em>element inside the <em>system.web</em> element of your web.config.</p>
<p>The &#8220;remember me&#8221; option for authentication should start working as expected.</p>
<h3>Why this Works</h3>
<p>When a user authenticates on an ASP.NET website with forms authentication enabled, an authentication ticket is generated for that user. This ticket is then stored inside a cookie in the user&#8217;s browser. The cookie&#8217;s purpose is to allow the forms authentication system to recognize subsequent requests by the same user as valid/authenticated.</p>
<p>Of course, this functionality works without issue even before the solution above. When a user leaves the &#8220;remember me&#8221; box unchecked, a session cookie is stored in their browser. Checking that box, sends a persistent cookie back to the browser instead. This persistent cookie is set to expire based on the timeout value mentioned earlier (i.e. it expires approximately timeout minutes from the current date/time). The persistent cookie is also created without issue. A quick look at your cookies during a test should prove this.</p>
<p>So, if the persistent cookie is getting created properly, why are users being forced to login again after only short periods of inactivity? Well, the authentication ticket is <strong>encrypted </strong>before being sent to the browser as a cookie. This is done to secure the details of the ticket and prevent tampering. However, the ticket must be <strong>decrypted </strong>by the forms authentication system on each request that follows.</p>
<h4>Process Recycling</h4>
<p>When the ASP.NET process recycles, the website&#8217;s validation and decryption keys may be randomly re-generated. In fact, the default behavior is to auto-generated these keys per application. If the keys are changed, <strong>those tickets cannot be decrypted</strong>. When the forms authentication system fails to decrypt a ticket from the user&#8217;s cookie, it sends them along to the login page for validation. No amount of checking the &#8220;remember me&#8221; box will help this situation; specifying your own keys in web.config will.</p>
<h4>Causes of Process Recycling</h4>
<p>There are a number of causes for the ASP.NET process getting recycled. Here just a few.</p>
<ul>
<li>IIS determines certain conditions were met</li>
<li>any change in the bin directory of the website</li>
<li>changes to the physical path of the virtual application or website</li>
<li>a sub-directory of the website is deleted</li>
<li>changes to Global.asax, web.config, or machine.config</li>
<li>policy changes</li>
<li>the count threshold of re-compilations is exceeded (<span style="font-family: Tahoma;"><em>numRecompilesBeforeAppRestart </em>on the <em>compilation </em>element)</span></li>
</ul>
<p>If your website is hosted on a shared server, odds are the process for your application will get recycled more often than on a dedicated server. Hosts set the thresholds for recycling pretty low for shared hosing servers to account for poor programming.</p>
<h3>Final Recommendations</h3>
<p>I almost always recommend that one of the first things a developer does with a new ASP.NET website is generate a random <em>machineKey </em>and add to the web.config. This will likely save you many headaches in the future. By the way, this step is absolutely <strong>necessary </strong>for Web farms/gardens.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/aspnet-remember-me-option-forms-authentication-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN, the Way of the Tortoise</title>
		<link>http://www.geekfreeq.com/svn-tortoise/</link>
		<comments>http://www.geekfreeq.com/svn-tortoise/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 19:29:16 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Desktop Development]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.geekfreeq.com/?p=455</guid>
		<description><![CDATA[Although, Subversion (SVN) is not new, it is still one of the most widely used version control systems (VCS) available. SVN is a tool that allows users to track the changes of files. Yes, it&#8217;s that simple.
Interfacing Your Demons
Like many version control systems, SVN utilizes a command-line interface (CLI) to interact with users. Some users [...]]]></description>
			<content:encoded><![CDATA[<p>Although, <a href="http://subversion.tigris.org/" target="_blank">Subversion</a> (SVN) is not new, it is still one of the most widely used <a href="http://en.wikipedia.org/wiki/Revision_control" target="_blank">version control systems</a> (VCS) available. SVN is a tool that allows users to track the changes of files. Yes, it&#8217;s that simple.</p>
<h3>Interfacing Your Demons</h3>
<p>Like many version control systems, SVN utilizes a <a href="http://en.wikipedia.org/wiki/Command_line" target="_blank">command-line interface</a> (CLI) to interact with users. Some users frown upon the command-line; especially, Windows users. However, I want to point out how necessary it is that these tools use the command-line.</p>
<p>After you use a version control system for a good length of time, you should notice that there are routines you follow over and over again. Perhaps you lock certain files before editing them to prevent conflicts with other potential editors on your team. Maybe you always commit your changes when you build a project for release, or when you shut down your computer for the evening. The point is, these are things that can be automated with small scripts through build events or even Windows Task Scheduler. Having a command-line tool is essential to such automation.</p>
<p>On the other hand, there are many times you will want to issue commands to SVN on-demand. A nice <a href="http://en.wikipedia.org/wiki/Graphical_user_interface" target="_blank">graphical user interface</a> can make things much easier and faster for those tasks. Enter <a href="http://tortoisesvn.net/" target="_blank">TortoiseSVN</a>.</p>
<p><span id="more-455"></span></p>
<h3>TortoiseSVN and the Shell</h3>
<p>I like to think that the tortoise stands for something meaningful. Granted SVN was created as an alternative to CVS, which had TortoiseCVS. For me, it&#8217;s all about the shell!</p>
<div class="wp-caption alignleft" style="width: 172px"><img title="TortoiseSVN Context Menu" src="http://farm3.static.flickr.com/2548/4011600230_8596853849_o.gif" alt="TortoiseSVN Shell Context Menu" width="162" height="64" /><p class="wp-caption-text">TortoiseSVN Context Menu</p></div>
<p>TortoiseSVN integrates with the <a href="http://en.wikipedia.org/wiki/Windows_shell" target="_blank">Windows shell</a>. That means a <strong>lot </strong>in the way of usability. When you right-click a file from <em>anywhere </em>in Windows, you will see contextual items on the menu for TortoiseSVN commands. Personally, I think this gives much more value to the program than those that just mingle with <a href="http://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank">integrated development environments</a> (IDEs). I use SVN to control more than just source code. In fact, I consider my other project assets to be just as important (i.e. original design images, documentation, research, etc.). Integration with the shell means I can open Windows Explorer and start managing my files with TortoiseSVN.</p>
<h3>Repositories</h3>
<p>Repositories are where your files, and their many versions, are stored. There are many theories on how to organize your repositories, from creating one for each project to creating one for everything. I prefer creating a repository for each solution I am working on. That is, I create a repository for every application, website, or stand-alone library that I work on. My reasoning stems from the fact that I may need to invite new team members into the development process for a given application or website, and I want to be able to ensure they only have access to what they need. It also makes it very easy to move a repository to a remote, shared location in the future.</p>
<p>I do, however, store <strong>all</strong> of my repositories in a single directory on the computer chosen to host them. This makes for a very clean and trivial backup structure. I can easily backup all of my repositories by simply pointing to this root directory. I name mine, &#8220;SVNRepositories&#8221;. Aren&#8217;t I clever?</p>
<h4>Use Templates</h4>
<p>As a programmer and architect, I am a <strong>huge </strong>fan of templates. They make things so much easier. Creating stuff from templates is quicker and less riddled with mistakes. The idea of using templates to create your repositories may seem too trivial to bother with, but it does speed things up and ensures that you stick to a naming convention. Many recommend the following directory structure for repositories.</p>
<ul class="Folders">
<li>SVN Structure
<ul>
<li>branches</li>
<li>tags</li>
<li>trunk</li>
</ul>
</li>
</ul>
<p>The <strong>trunk </strong>is where your primary development line will be maintained. You will commit most of your changes to the trunk. You will most often update your working directory from the trunk (more on this soon). The trunk is the latest official version of your solution. There are conflicting views on exactly how to use the trunk, but this is the most widely accepted usage of it.</p>
<p><strong>Branches </strong>are there for you to try new things and to experiment with the solution/project. Create a branch when you do not want to mess up the trunk with possible breaking changes. Branching is most common when a new feature is being developed that will take some time to implement. You would create a branch from the trunk and begin working on the branch; committing and updating to and from the branch instead of the trunk. Once the feature is complete, the branch should be merged back into the trunk and become part of the overall solution.</p>
<p><em>Note: It is good practice to merge the trunk into a developing branch every so often, so the branch can benefit from any changes made on the trunk.</em></p>
<p><strong>Tags </strong>are ideal for marking milestones for the solution/project. It&#8217;s a good idea to &#8220;tag&#8221; each release of the software, documentation, or the like. This allows you to time travel back to a release at a future point if you need to troubleshoot an issue with that old release, or to revert back to a release if things go awry later. For example, a diet-tracking website I am constantly improving upon will soon be sent to a buddy of mine for his personal use. Each time I send him an update, I will tag that release so I can instruct SVN to find the difference between then and now in order to send him a patch.</p>
<p>Create a directory on your computer that has the 3 sub-directories above in it. The sub-directories should be empty. Name the parent directory as your template structure so that you can find it later. I named mine, &#8220;SVN Structure&#8221;, and have it in a folder named, &#8220;Templates&#8221;.</p>
<h4>New Repositories</h4>
<p>Follow these steps to create a new repository that is consistent with the best practices discussed above.</p>
<div class="wp-caption alignright" style="width: 168px"><img title="New Repositories" src="http://farm3.static.flickr.com/2503/4011737526_2ec93ce208_o.gif" alt="TortoiseSVN - New Repositories" width="158" height="159" /><p class="wp-caption-text">New Repositories</p></div>
<ol>
<li>Create a new sub-directory in your SVNRepositories directory. Make sure you give it a meaningful name for the project/solution it will manage.</li>
<li>Right-click the new sub-directory, hover your mouse over the TortoiseSVN context menu, and click &#8220;Create repository here&#8221;.</li>
<li>You should see a confirmation message that the repository was successfully created.</li>
<li>Navigate to your &#8220;SVN Structure&#8221; directory template, right-click it, hover your mouse over the TortoiseSVN context menu, and click &#8220;Import&#8230;&#8221;.</li>
<li>Enter/select the URL of the new repository you just created. If the repository is on your network, you will use a URL in the form of <a class="linkification-ext" title="Linkification: file:///X:/SVNRepositories/RepositoryName" href="file:///X:/SVNRepositories/RepositoryName">file:///X:/SVNRepositories/RepositoryName</a>. Otherwise, use a valid Web URL for the remote location.</li>
<li>Supply a nice message for the import. I recommend, &#8220;Structure import.&#8221;</li>
<li>Click OK.</li>
<li>Enjoy the log displayed that informs you of the successful addition of the 3 directories and click OK.</li>
</ol>
<p>Feel free to right-click on any folder and choose the &#8220;Repo-browser&#8221; item from the TortoiseSVN context menu. After entering/selecting the URL to your repository, you should see the new structure eagerly awaiting files to manage.</p>
<h3>Working Directories</h3>
<p>A working directory is where you make the changes to your files. These are standard directories that have hidden SVN sub-directories tucked away for change tracking and property management. The presence of these hidden directories is what enables the icon overlays and most commands on the TortoiseSVN context menu.</p>
<p>You can have multiple working directories; even for the same repository. In fact, if you are working on the trunk <strong>and</strong> a branch of your project/solution, you will likely want to have separate working directories, as opposed to switching back and forth between each. Simply, create another directory separate from your current working directory, and checkout the other branch or tag to the new location. Then, you can work in both directories and update/commit to the appropriate trunk/branch/tag for each.</p>
<h4>Setting Up in a Clean Working Directory</h4>
<p>Consider setting up version control <em>before </em>you begin working on a new project. It will make setup easier, and it will ensure that you can start committing changes immediately.</p>
<p>Setting up in a clean working directory is a cinch! After you have created your repository from the structure template provided earlier, follow these steps.</p>
<div class="wp-caption alignright" style="width: 163px"><img title="Checkout" src="http://farm4.static.flickr.com/3522/4011647984_f83956c6f8_o.gif" alt="TortoiseSVN - Checkout" width="153" height="46" /><p class="wp-caption-text">Checkout</p></div>
<ol>
<li>Create a new directory where you would like to start working on your project/solution (e.g. C:\My Documents\My Projects\New Project).</li>
<li>Right-click the new directory and click &#8220;SVN Checkout&#8230;&#8221;.</li>
<li>Enter/select the URL of your new repository.</li>
<li>Append &#8220;/trunk&#8221; to the end of your repository URL (i.e. <a class="linkification-ext" title="Linkification: file:///X:/SVNRepositories/RepositoryName/trunk" href="file:///X:/SVNRepositories/RepositoryName/trunk">file:///X:/SVNRepositories/RepositoryName/trunk</a>).</li>
<li>Ensure that the checkout directory is set to the one you just right-clicked.</li>
<li>Keep the checkout depth set to &#8220;Fully recursive&#8221;.</li>
<li>Make sure the &#8220;HEAD revision&#8221; is selected.</li>
<li>Click OK.</li>
<li>Enjoy the success log and click OK.</li>
</ol>
<p>You now have a working directory all ready to be filled with files. You may notice that the folder icon for your new working directory has a green check overlaying it <img class="Inline" title="TortoiseSVN - Check Overlay" src="http://farm3.static.flickr.com/2493/4010883017_e2783ea58a_o.gif" alt="Check Overlay" width="16" height="14" /> (if you do not see it, refresh Windows Explorer until it appears). This indicates that no changes have been made to files in that directory. Considering there <em>are </em>no files, this makes sense.</p>
<h4>Setting Up in an Existing Working Directory</h4>
<p>If you already began your project and have files inside your working directory, don&#8217;t worry. It isn&#8217;t too much of a pain to get your working directory synchronized with your new repository.</p>
<p>After you have created your repository from the structure template provided earlier, follow these steps.</p>
<div class="wp-caption alignright" style="width: 221px"><img title="Commit" src="http://farm3.static.flickr.com/2600/4014369306_d657f62a3d_m.jpg" alt="TortoiseSVN - Commit" width="211" height="240" /><p class="wp-caption-text">Commit</p></div>
<ol>
<li>Create a new directory, anywhere you&#8217;d like, to hold all of your existing project files temporarily. I often just create a temporary folder on my desktop.</li>
<li>Move (<strong>not </strong>copy, move) all the files and folders that are in your existing working directory to the new temporary directory you created in step 1.</li>
<li>Your existing working directory should be completely empty now.</li>
<li>Right-click the, now empty, working directory and click &#8220;SVN Checkout&#8230;&#8221;.</li>
<li>Enter/select the URL of your new repository.</li>
<li>Append &#8220;/trunk&#8221; to the end of your repository URL (i.e. <a class="linkification-ext" title="Linkification: file:///X:/SVNRepositories/RepositoryName/trunk" href="file:///X:/SVNRepositories/RepositoryName/trunk">file:///X:/SVNRepositories/RepositoryName/trunk</a>).</li>
<li>Ensure that the checkout directory is set to the one you just right-clicked.</li>
<li>Keep the checkout depth set to &#8220;Fully recursive&#8221;.</li>
<li>Make sure the &#8220;HEAD revision&#8221; is selected.</li>
<li>Click OK.</li>
<li>Enjoy the success log and click OK.</li>
<li>Move all of your files and folders back to the working directory from the temporary folder you moved them to in step 2.</li>
<li>Feel free to delete the temporary folder after you verify all the files/folders moved over.</li>
<li>If you peek inside your working directory now, you should see a blue question mark image overlaying your file and folder icons <img class="Inline" title="TortoiseSVN - Question Overlay" src="http://farm3.static.flickr.com/2542/4010882951_0a7297b46a_o.gif" alt="Question Overlay" width="16" height="14" />. This icon indicates that the files/folders are unknown to your repository at this time. In other words, they are not versioned yet. It&#8217;s time to fix that!</li>
<li>Navigate to the parent directory of your working directory, so you can see the working directory in the list of folders. It should have the green check overlay.</li>
<li>Right-click the working directory and click &#8220;SVN Commit&#8230;&#8221;.</li>
<li>Enter a nice message for the initial commit. I recommend, &#8220;Initial commit&#8221;, or similar.</li>
<li>Select all the files and folders you want to add to the repository (drag a rectangle around them with your mouse, or Shift/Ctrl click them), right-click one of them, and click &#8220;Add&#8221;.</li>
<li>If there are any files you want to ignore from now on, select them, right-click one, and click &#8220;Ignore x items by name&#8221;. You may also select a single file and choose to ignore it or all files with the same extension.</li>
<li>Finally, click OK to commit the files to your repository.</li>
<li>Enjoy the success log and click OK.</li>
</ol>
<p>Your existing working directory is now under version control!</p>
<h3>What Next?</h3>
<p>After you have a repository setup and a working directory linked to it, there&#8217;s not much more to do except&#8230;get to work. Just update your working directory, make changes to your files, and commit the changes back to the repository at the end of the day (or sooner if you feel the need). Of course, there are some minor caveats to keep in mind in your daily use.</p>
<h4>Special Actions</h4>
<div class="wp-caption alignright" style="width: 193px"><img title="Rename" src="http://farm4.static.flickr.com/3503/4011648006_4fd48de588_o.gif" alt="TortoiseSVN - Rename" width="183" height="384" /><p class="wp-caption-text">Rename</p></div>
<p>Adding and editing files under version control is a no-brainer. However, there are special considerations for file renaming and moving. If a file is already under version control and you want to rename/move it or delete it, you must use TortoiseSVN to accomplish this in order for it to properly account for the action. Truthfully, you can just delete files and TortoiseSVN will let you mark those files as deleted the next time you issue a commit. The renames/moves are the real trouble-makers if you just make those changes outside of TortoiseSVN.</p>
<p>If you need to rename or move a file, right-click it, and select &#8220;Rename&#8230;&#8221; from the TortoiseSVN context menu. Enter the new name of the file to rename it, or enter the relative path and file name if you want to move it (i.e. SomeSubDirectory\MyFile.txt). Alternatively, you can right-click-drag (drag with the right mouse button) the file to another folder and select &#8220;SVN Move versioned item(s) here&#8221;.</p>
<p>This will instruct SVN to delete the original file and add a new one with the new name/location. If you rename/move an entire folder, you <strong>must</strong> commit the changes before editing any files inside that folder. In addition, make <em>absolutely certain</em> that you <strong>do not</strong> rename, move, or delete a <em>directory </em>that is under version control <strong>except via SVN or TortoiseSVN</strong>. Doing so, will change those hidden SVN sub-directories and that would be very bad. For all the details on these actions, read the <a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-rename.html" target="_blank">Deleting, Moving and Renaming section</a> of the <a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug.html" target="_blank">Daily Use Guide</a>.</p>
<h3>Further Reading</h3>
<p>I highly recommend that you learn all the capabilities of both SVN and TortoiseSVN. These are great products aimed at helping us stay organized and track revised files. Below is a list of resources I believe are helpful to beginners and seasoned users alike.</p>
<ul>
<li><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug.html" target="_blank">TortoiseSVN &#8211; Daily Use Guide</a> &#8211; this is a must-read
<ul>
<li><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-branchtag.html" target="_blank">Branching / Tagging</a></li>
<li><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-merge.html" target="_blank">Merging</a></li>
<li><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html" target="_blank">Creating and Applying Patches</a></li>
</ul>
</li>
<li><a href="http://tortoisesvn.net/most-forgotten-feature" target="_blank">TortoiseSVN &#8211; Most Forgotten Feature</a></li>
<li><a href="http://tortoisesvn.tigris.org/faq.html" target="_blank">TortoiseSVN FAQ</a></li>
<li><a href="http://svnbook.red-bean.com/" target="_blank">Version Control with Subversion (free online version)</a> &#8211; the official Subversion book</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/svn-tortoise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Save the Developers Lost to Microsoft?</title>
		<link>http://www.geekfreeq.com/save-developers-lost-microsoft/</link>
		<comments>http://www.geekfreeq.com/save-developers-lost-microsoft/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 02:58:39 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.geekfreeq.com/?p=402</guid>
		<description><![CDATA[Save the Developers was a site dedicated to educating Web surfers about the tremendous failings of Microsoft&#8217;s Internet Explorer browsers. The site sported a free &#8220;badge&#8221; for Web developers and webmasters to include on websites to spread the word. &#8220;The word&#8221; being that Internet Explorer versions prior to 8 ignore all standards for HTML and [...]]]></description>
			<content:encoded><![CDATA[<p>Save the Developers <strong>was</strong> a site dedicated to educating Web surfers about the tremendous failings of Microsoft&#8217;s Internet Explorer browsers. The site <strong>sported </strong>a free &#8220;badge&#8221; for Web developers and webmasters to include on websites to spread the word. &#8220;The word&#8221; being that Internet Explorer versions prior to 8 ignore all standards for HTML and CSS (the markup used by Web developers to create webpages). Ultimately, users <strong>were </strong>pleaded with to upgrade  to version 8 beta; at least leave version 6 behind and move on to version 7.</p>
<p>So, why all the past-tense in my explanation above? Well, the Save the Developers website  (<a href="http://savethedevelopers.org/" target="_blank">savethedevelopers.org</a>) now redirects to Microsoft&#8217;s website for Internet Explorer 7 and 8 beta. At first, one might assume that Microsoft bought the domain for the website and issued the redirect themselves. However, I&#8217;m not so sure about that upon some digging.</p>
<p>A whois query for microsoft.com reveals that the owner of that domain is Microsoft Corporation; no surprise there. However, a whois for savethedevelopers.org (and .com) shows the owner to be Conveyor Group. There is only a month left before the domains expire, so who knows. Maybe they succumbed to the financial power of Microsoft.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/save-developers-lost-microsoft/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simpler Robust ASP.NET Providers</title>
		<link>http://www.geekfreeq.com/simpler-robust-aspnet-providers/</link>
		<comments>http://www.geekfreeq.com/simpler-robust-aspnet-providers/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 03:21:39 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.ventaur.com/?p=22</guid>
		<description><![CDATA[I don&#8217;t like writing about something that I&#8217;m &#8220;currently working on&#8221; too often. The problem with that is sometimes other things (e.g. life) get in the way of my proposed timelines. All that aside, there are times when the standard SQL web providers are overly complicated for the rest of my database schema. I think [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t like writing about something that I&#8217;m &#8220;currently working on&#8221; too often. The problem with that is sometimes other things (e.g. life) get in the way of my proposed timelines. All that aside, there are times when the standard SQL web providers are overly complicated for the rest of my database schema. I think it&#8217;s great that you can use the same tables for multiple applications. It&#8217;s also great that the primary keys for most of the entities are <a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier" target="_blank">GUID</a>s, since these are much harder for an unauthorized user to guess.</p>
<p>Sometimes it&#8217;s all just too much!</p>
<h3>Integration with the Rest of Your Schema</h3>
<p>The default implementation of the ASP.NET providers are not ideal for integrating with the rest of your database schema. By that I mean, if you want to include a foreign key to a user&#8217;s ID in a table that you&#8217;ve created for your application, you&#8217;ll have to play by those default rules. Your foreign key will have to be a unique identifier (SQL Server&#8217;s GUID data type).</p>
<p>What if I&#8217;ve already defined my entire schema and the User ID I had in mind is an integer?</p>
<h3>Write Your Own Providers</h3>
<p>Something that I truly appreciate with ASP.NET since version 2 are providers. Being able to customize the implementation details of specific pieces of a well-defined machine is empowering. Unfortunately, for the membership, role and profile providers, your data for each will more than likely be interdependent. For example, you cannot use the default SqlMembershipProvider with a custom role provider that does not link to the aspnet_Users table or use a GUID for the User ID when associating roles to users. If you want to change the data type of the primary keys for some entities, you&#8217;ll have to write custom providers for all aspects you wish to use in your application.</p>
<p>It&#8217;s also not as simple as just changing the data type from a uniqueidentifier to an int. Ideally, the flexibility to configure the providers to use one of your own existing tables in the database would be more robust than hard-coding several table names into the code. What if the provider uses the correct database provider based on the supplied connection string? How about the option to use dynamic SQL or stored procedures?</p>
<p>These would all be very nice features for a set of ASP.NET providers. Of course, I have a real-world example. My host lets me create MySQL databases for my website. They have MySQL 5 installed, which has the ability to create stored procedures (after a bit of a wait). The only trick here is, stored procedures in MySQL 5 are actually stored in the &#8220;mysql&#8221; database. This can pose a problem for security in a shared hosting environment. Everyone&#8217;s stored procedures are in the same &#8220;bucket&#8221;! It would be great if I could configure my membership and role providers to use MySQL and build dynamic SQL instead of relying on stored procedures.</p>
<h3>They&#8217;re Coming</h3>
<p>That&#8217;s the plan. I am currently writing ASP.NET providers that offer all the benefits mentioned above. When will this project be complete? Who knows with my schedule! I can tell you that I have a couple of big websites that I&#8217;m working on that will require MySQL as the backing database. They also require membership and roles support. I guess I&#8217;ll be finishing the providers in order to complete those websites. ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/simpler-robust-aspnet-providers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Page Security &#8211; New Version</title>
		<link>http://www.geekfreeq.com/web-page-security-new-version/</link>
		<comments>http://www.geekfreeq.com/web-page-security-new-version/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 01:10:52 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.ventaur.com/?p=18</guid>
		<description><![CDATA[Some of you know me as a friend and code poet. Some know me as the crazy guy trying to get donations for his dad to get him a Wii. Some just know me as &#8220;that guy who wrote the web page security module for ASP.NET&#8220;. Others don&#8217;t know me at all; how did you [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you know me as a friend and code poet. Some know me as the crazy guy trying to get <a href="http://mydadneedsawii.com/" target="_blank">donations for his dad to get him a Wii</a>. Some just know me as &#8220;that guy who wrote the <a href="http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx" target="_blank">web page security module for ASP.NET</a>&#8220;. Others don&#8217;t know me at all; how did you end up here by the way?</p>
<p>Well, I am finally setting out to write the next version of the web page security module. I have quite a list of features requested by its many users. The fact is, I&#8217;ve been wanting to write the new version for nearly 2 years now. I have an idea that will make this thing so much more usable that I&#8217;m beginning to doubt its efficiency. So, before I begin putting too much effort into it, I will be running some tests, like a responsible programmer.</p>
<p>I suspect the new method I have in mind will be a bit more CPU-intensive. The problem is, I have no idea <strong>how much more</strong> CPU I can expect the algorithm to use. I&#8217;ll see how my tests go, beginning tonight. If the metrics show an acceptable increase in CPU (I&#8217;ll have to decide what is acceptable), I will begin coding the new version this week.</p>
<p>Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/web-page-security-new-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Membership and Role Providers</title>
		<link>http://www.geekfreeq.com/custom-membership-role-providers/</link>
		<comments>http://www.geekfreeq.com/custom-membership-role-providers/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 16:38:02 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.ventaur.com/?p=15</guid>
		<description><![CDATA[I work for a community college as their webmaster/web programmer and things tend to be very disparate with regards to systems. The student information system speaks its own language and interfaces with its own data. The Active Directory trees are updated manually each semester. The website has several internal and external tools that various users [...]]]></description>
			<content:encoded><![CDATA[<p>I work for a community college as their webmaster/web programmer and things tend to be very disparate with regards to systems. The student information system speaks its own language and interfaces with its own data. The Active Directory trees are updated manually each semester. The website has several internal and external tools that various users can use to achieve certain goals.</p>
<p>When trying to communicate across these and other involved systems, it can get a bit crazy. The Web tools are my primary concern. They require authorization granularity that just is not offered via our Active Directory (AD) layout. For example, some of those tools have some users that share a similar AD group and other users that do not. In addition, not all users of an existing group should have access to a given tool. Yet specific collections of users needs access to these tools and I am responsible for granting such access.</p>
<p><span id="more-26"></span></p>
<h3>An Obvious Solution</h3>
<p>The first solution that one may consider is to create new AD groups for the user of the tools. However, the network administrator need not be concerned with these specialized &#8220;Web groups&#8221; for his routine tasks. He also should not have to worry about granting me permission to create the groups that I continually need, or repeatedly filling requests to create them on my behalf.</p>
<p>When performing audits of the AD entities, the network administrator will have no idea what purpose certain groups fulfill and whether or not they are no longer needed. That is, of course, without constant communication and documentation from me. Likewise, when I <strong>absolutely </strong>need to add a user to one of the specialized groups in order to grant access to a tool, I cannot be guaranteed quick processing of my request; especially around lunchtime.</p>
<h3>A Hybrid Solution</h3>
<p>This is where the power of ASP.NET&#8217;s custom providers comes into play. To solve the above problems, I devised a hybrid role provider. The new custom provider allows me to see what AD groups a user belongs to and manage my own roles for the website.</p>
<p>I only care about a small subset of all the AD groups, so I mapped them to roles in my database. These mapped roles are not editable via the provider. Therefore, users cannot be added to, or removed from, them since they are virtually a link to the read-only AD groups. I am free, however, to create my own roles in the database and add/remove users to them internally.</p>
<p>The custom role provider handles everything for me. It overrides most of the virtual properties and methods of the base <em>RoleProvider</em> class. It ensures that the provider is not used to modify the AD mapped roles. It also looks up what AD groups a given user belongs to, as well as what users belong to a given group, via LDAP.</p>
<p>Lastly, the custom role provider manages &#8220;calculated roles&#8221;. Calculated roles are those that are implicit to a user in the website database. These include: instructors, department heads, course coordinators, etc. The presence of one or more records in various tables or the value of a field in a table are ways the calculated roles are determined.</p>
<p>To assist with several aspects of the website&#8217;s needs, I also created a custom membership provider that descends from the <em>ActiveDirectoryMembershipProvider </em>class. The main reason for this is to make use of a custom <em>ActiveDirectoryMembershipUser </em>class that contains often needed information about the currently logged in network user.</p>
<h3>The Result</h3>
<p>With my new custom role provider (and matching membership provider) I get seamless authentication with our Active Directory structure and a very robust hybrid system for authorization. I can create website-specific roles, assign users to those roles, and check users against common AD groups used across the college. Each of these abilities grants me the ease of using the many declarative authorization approaches available to me via ASP.NET. I can configure directories and/or individual pages to authorize users based on their AD group and/or their custom website role.</p>
<p>When completed, I was able to offer the internal users of the website an array of custom tools that are authorized transparently to appropriate individuals. That is some great power allowed by the provider system<br />
in ASP.NET. It was fairly easy to pull off too. I thought out my needs, and with less than a thousand lines of code, I have a complete and robust solution.</p>
<h3>The Lesson</h3>
<p>Do not accept the lack of a feature as a limitation; especially with regards to the .NET Framework. Sure, there will be times where you are limited (those horrible choices some Framework developers make to mark a very useful method as internal), but with each new version, we (the developers) are given ways to replace entire systems at work across one or more applications.</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/custom-membership-role-providers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LINQ with SQL Server CE 3.5</title>
		<link>http://www.geekfreeq.com/linq-sql-server-ce-35/</link>
		<comments>http://www.geekfreeq.com/linq-sql-server-ce-35/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 03:00:05 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Data Practice]]></category>
		<category><![CDATA[Desktop Development]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blog.ventaur.com/index.php/archives/linq-with-sql-server-ce-35</guid>
		<description><![CDATA[LINQ is an extremely useful new language feature for the .NET Framework 3.5. It allows querying all sorts of data structures via the actual programming language (thus the Language INtegrated in LINQ). In addition, the specific variant, LINQ to SQL, includes a full O/RM (Object/Relational Mapper). Since many developers spend a ton of time mapping [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx" target="_blank">LINQ</a> is an extremely useful new language feature for the .NET Framework 3.5. It allows querying all sorts of data structures via the actual programming language (thus the Language INtegrated in LINQ). In addition, the specific variant, <a href="http://msdn2.microsoft.com/en-us/library/bb386976.aspx" target="_blank">LINQ to SQL</a>, includes a full <a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank">O/RM</a> (Object/Relational Mapper). Since many developers spend a ton of time mapping their relational data to objects, this included tool is a phenomenal time-saver. Of course, this is not a new concept, nor is it the first of its kind for .NET. It&#8217;s just free and included!</p>
<p>LINQ to SQL currently only works with <a href="http://www.microsoft.com/sql/2005/" target="_blank">SQL Server 2005</a>. It&#8217;s not likely that Microsoft will bother with any other providers with the <a href="http://msdn2.microsoft.com/en-us/library/bb399572.aspx" target="_blank">Entity Framework</a> and <a href="http://msdn2.microsoft.com/en-us/library/bb386964.aspx" target="_blank">LINQ to Entities</a> on the horizon. There is a way to get standard LINQ to SQL to work with the SQL Server Compact Edition (SSCE) however. You have to use the <a href="http://msdn2.microsoft.com/en-us/library/bb386987.aspx" target="_blank">SqlMetal</a> command-line tool to generate the appropriate file(s). Once you generate the .dbml file, you can even open it in the <a href="http://msdn2.microsoft.com/vstudio/products/" target="_blank">Visual Studio 2008</a> designer.</p>
<p><span id="more-25"></span></p>
<h3>Deploying SSCE when Using LINQ</h3>
<p>Deploying SSCE with your desktop application is pretty easy. You can quickly publish your application via <a href="http://msdn2.microsoft.com/en-us/library/t71a733d.aspx" target="_blank">ClickOnce</a>, but I&#8217;m not a big fan of that technology. Instead, I prefer an installer program. You can use any one that you prefer and still easily deploy SSCE with a couple of options.</p>
<h4>Windows Installer</h4>
<p>First, you can choose to create a pre-requisite or dependency tests for the system installation of SSCE for the version you require (3.5 or later to work with LINQ). If the engine is not installed, you can send the user to the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=7849B34F-67AB-481F-A5A5-4990597B0297" target="_blank">Microsoft website</a> for installation or you can launch the redistributable <a href="http://msdn2.microsoft.com/en-us/library/aa367449.aspx" target="_blank">Windows Installer</a> file for it. This method requires that the user have <em>Administrator </em>privileges in order to perform the system install.</p>
<p>Please note that if you launch the .msi file to install SSCE and your installer is a Windows Installer program, you will have to close your installer first; two instances of Windows Installer cannot be run simultaneously.</p>
<h4>X-Copy</h4>
<p>Second, you can just copy the necessary redistributable library files for the SSCE engine into your application&#8217;s install directory. This method does <strong>not</strong> require <em>Administrator</em> privileges! There are 7 files that need to be copied with your application and they should be copied to the same directory as your primary executable.</p>
<ul>
<li>sqlceca35.dll</li>
<li>sqlcecompact35.dll</li>
<li>sqlceer35EN.dll</li>
<li>sqlceme35.dll</li>
<li>sqlceoledb35.dll</li>
<li>sqlceqp35.dll</li>
<li>sqlcese35.dll</li>
</ul>
<p>Make sure your application references the System.Data.SqlServerCe.dll assembly and it is set to copy the assembly locally as well. This is especially important when you use LINQ to SQL with SSCE because that assembly is implied at runtime and therefore not explicitly required as a reference in your application until it&#8217;s time to deploy on a system that does not have SSCE installed.</p>
<p>Please, be aware that if you choose to redistribute SSCE in either form (Windows Installer or individual libraries), you must <a href="http://www.microsoft.com/sql/editions/compact/redistribute.mspx" target="_blank">register for redistribution rights</a> with Microsoft.</p>
<h4>The Hidden Problem</h4>
<p>There is a hidden problem with all of this will finally crop up with the x-copy method. Since LINQ uses a <a href="http://en.wikipedia.org/wiki/Factory_method_pattern" target="_blank">factory pattern</a> to acquire the necessary data provider, the necessary reference to the provider does not occur until runtime. Herein lies the problem.</p>
<p>When your application makes that first attempt via LINQ to connect to the SSCE database file without a system install, you will receive the following error message:</p>
<blockquote><p>Cannot open &#8220;X:Pathtodatafiledatafile.sdf&#8221;. Provider &#8216;System.Data.SqlServerCe.3.5&#8242; not installed.</p>
</blockquote>
<p>If SSCE is installed by the user via the Windows Installer file, this problem is handled for you. The installer adds an entry to your machine.config file. Since the whole purpose of an x-copy install is usually to avoid the need for <em>Administrator</em> privileges, this just will not do.</p>
<p>Instead, you will need to add an application configuration file to your desktop application, if you do not have one already. Right-click your project in &#8220;Solution Explorer&#8221;, choose &#8220;Add new&#8230;&#8221;, select &#8220;Application Configuration&#8221;, and click OK. Make sure the new file looks like this:</p>
<pre name="code" class="xml">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SqlServerCe.3.5" /&gt;
      &lt;add
        name="Microsoft SQL Server Compact Data Provider"
        invariant="System.Data.SqlServerCe.3.5"
        description=".NET Framework Data Provider for Microsoft SQL Server Compact"
        type="System.Data.SqlServerCe.SqlCeProviderFactory,
          System.Data.SqlServerCe,
          Version=3.5.0.0,
          Culture=neutral,
          PublicKeyToken=89845dcd8080cc91"
      /&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;</pre>
<p>This ensures that the appropriate database provider factory is added for your application, without the need to edit the end-user&#8217;s machine.config file or require a system installation of SSCE.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekfreeq.com/linq-sql-server-ce-35/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
