<?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>Richard Willis &#187; Development</title>
	<atom:link href="http://blog.salamandersoft.co.uk/index.php/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.salamandersoft.co.uk</link>
	<description>SalamanderSoft, SharePoint Learning Kit, Microsoft Learning Gateway &#38; SharePoint Development</description>
	<lastBuildDate>Thu, 29 Jul 2010 00:13:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Set List Folder Contents</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2010/07/how-to-set-list-folder-contents/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2010/07/how-to-set-list-folder-contents/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:34:08 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[File System]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2010/07/how-to-set-list-folder-contents/</guid>
		<description><![CDATA[This is a reminder for myself more than anything. 
To set &#34;List Folder Contents&#34; on a folder you need to set:
FileSystemRights.ReadAndExecute
InheritanceFlags.ContainerOnly
PropagationFlags.None
&#160;
The only difference between &#34;List Folder Contents&#34; and &#34;Read &#38; Execute&#34; is that List Folder Contents is only inherited by folders rather than by folders and files.
]]></description>
			<content:encoded><![CDATA[<p>This is a reminder for myself more than anything. </p>
<p>To set &quot;List Folder Contents&quot; on a folder you need to set:</p>
<p>FileSystemRights.ReadAndExecute</p>
<p>InheritanceFlags.ContainerOnly</p>
<p>PropagationFlags.None</p>
<p>&#160;</p>
<p>The only difference between &quot;List Folder Contents&quot; and &quot;Read &amp; Execute&quot; is that List Folder Contents is only inherited by folders rather than by folders and files.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2010/07/how-to-set-list-folder-contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update a Dll in the GAC From the Command Line</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2010/07/update-a-dll-in-the-gac-from-the-command-line/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2010/07/update-a-dll-in-the-gac-from-the-command-line/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 08:22:40 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Command Line]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2010/07/update-a-dll-in-the-gac-from-the-command-line/</guid>
		<description><![CDATA[I’ve blogged before on how to Easily add a dll to the GAC, but that involves two instances of Windows Explorer and the mouse.
It would be quicker and easier to use the command line to update a dll in the GAC. You can do this with the Global Assembly Cache Tool gacutil, but this is [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve blogged before on how to <a href="http://blog.salamandersoft.co.uk/index.php/2008/12/easily-add-a-dll-to-the-gac/">Easily add a dll to the GAC</a>, but that involves two instances of Windows Explorer and the mouse.</p>
<p>It would be quicker and easier to use the command line to update a dll in the GAC. You can do this with the <a href="http://msdn.microsoft.com/en-us/library/ex0ss12c%28VS.80%29.aspx">Global Assembly Cache Tool gacutil</a>, but this is only present if you have the .net SDK or Windows SDK installed. This is going to be the case with your development machine, but you don’t really want to be installing it on all your test servers.</p>
<p>To get round this I knocked up a quick utility which will remove an existing version of a dll from the GAC and then install the latest version. The code is:</p>
</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">using</span> System;<span class="kwrd">using</span> System.Globalization;<span class="kwrd">using</span> System.EnterpriseServices.Internal;

<span class="kwrd">namespace</span> Test{    <span class="kwrd">public</span> <span class="kwrd">class</span> GacInstall    {        <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] arguments)        {            <span class="kwrd">try</span>            {                <span class="kwrd">string</span> assemblyPath = arguments[0];                Publish publish = <span class="kwrd">new</span> Publish();                publish.GacRemove(assemblyPath);                publish.GacInstall(assemblyPath);            }            <span class="kwrd">catch</span> (Exception e)            {                Console.WriteLine(e);            }        }    }}</pre>
<p></div>
<p>You can then use it by passing it the dll you want as a command line parameter e.g.</p>
<p>GacInstall MyUpdatedCode.dll</p>
<p>Assuming that MyUpdatedCode.dll is in the same directory.</p>
<p>Combined with my last tip <a href="http://blog.salamandersoft.co.uk/index.php/2010/07/recycle-an-individual-application-pool-from-the-command-line/">Recycle An Individual Application Pool From The Command Line</a> you can now write a bat or cmd file to replace the dll in the GAC and recycle the application pool with 2 key presses: The up arrow key and then return.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2010/07/update-a-dll-in-the-gac-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recycle An Individual Application Pool From The Command Line</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2010/07/recycle-an-individual-application-pool-from-the-command-line/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2010/07/recycle-an-individual-application-pool-from-the-command-line/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 07:24:00 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2010/07/recycle-an-individual-application-pool-from-the-command-line/</guid>
		<description><![CDATA[When developing SharePoint artifacts which live in the GAC you have the following options to get your new release in as part of the development process:

Build your installation package and upgrade it
Put the new dll in the GAC and run iisreset
Put the new dll in the GAC and recycle the SharePoint application pool

This is because [...]]]></description>
			<content:encoded><![CDATA[<p>When developing SharePoint artifacts which live in the GAC you have the following options to get your new release in as part of the development process:</p>
<ol>
<li>Build your installation package and upgrade it</li>
<li>Put the new dll in the GAC and run iisreset</li>
<li>Put the new dll in the GAC and recycle the SharePoint application pool</li>
</ol>
<ol>This is because SharePoint will only pick up updated dlls in the GAC after a recycle.</ol>
<p>As it is an iterative process when you are developing this happens a lot, so ideally you need a process which is as quick as possible. 1 &amp; 2 take the longest time so you should aim to use 3.</p>
<p>Luckily there is a command line command which will recycle individual application pools, which will be quicker than using the IIS administration tool. The command is</p>
<p>C:\windows\System32\inetsrv\appcmd.exe recycle apppool &quot;SharePoint &#8211; 80&quot;</p>
<p>Where you replace &quot;SharePoint &#8211; 80&quot; with the name of your application pool.</p>
<p>Of course when releasing to a live server you should always go down the proper installation package upgrade, this tip is purely for development purposes on your development server.</p>
<p>There’s a lot more you can do with appcmd – it’s a utility for making configuration changes to IIS so pretty much anything you can do through the IIS MMC snap in can be done via it. There are more details about appcmd on <a href="http://technet.microsoft.com/en-us/library/cc772200%28WS.10%29.aspx">Technet</a> or you can run</p>
<p>C:\windows\System32\inetsrv\appcmd.exe /?</p>
<p>to get help details.</p>
<p>Note: appcmd is for IIS7 not IIS6.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2010/07/recycle-an-individual-application-pool-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting the Owner of Files and Directories in C#</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/10/setting-the-owner-of-files-and-directories-in-c/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/10/setting-the-owner-of-files-and-directories-in-c/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 00:35:57 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2009/10/setting-the-owner-of-files-and-directories-in-c/</guid>
		<description><![CDATA[I recently had a requirement to set the owners of users home directories on a Windows server. The .Net framework has built-in support for this so it simply looked like a case of doing this:

IdentityReference owner = new NTAccount("MYDOMAIN\\MyUser");
DirectoryInfo directory = new DirectoryInfo("c:\\myDirectory");
DirectorySecurity directorySecurity = directory.GetAccessControl();
directorySecurity.SetOwner(owner);
directory.SetAccessControl(directorySecurity);


To remove the privilege you will just need to replace [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a requirement to set the owners of users home directories on a Windows server. The .Net framework has built-in support for this so it simply looked like a case of doing this:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5eb0acbd-f3be-4202-be58-0e67dcfe8c70" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: none;"><span style="color: #000000;">IdentityReference owner </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> NTAccount(</span><span style="color: #800000;">"</span><span style="color: #800000;">MYDOMAIN\\MyUser</span><span style="color: #800000;">"</span><span style="color: #000000;">);
DirectoryInfo directory </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> DirectoryInfo(</span><span style="color: #800000;">"</span><span style="color: #800000;">c:\\myDirectory</span><span style="color: #800000;">"</span><span style="color: #000000;">);
DirectorySecurity directorySecurity </span><span style="color: #000000;">=</span><span style="color: #000000;"> directory.GetAccessControl();
directorySecurity.SetOwner(owner);
directory.SetAccessControl(directorySecurity);
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>However, when I tried this I just got an InvalidOperationException with the message &quot;The security identifier is not allowed to be the owner of this object&quot;.</p>
<p>It turns out that the reason for this is that normally you are only allowed to take ownership yourself, and not assign it. For a user to take ownership they must either have been given the Take Ownership permission or be an administrator.</p>
<p>There is one exception to this rule, and that is if the user has the <strong>Restore files and directories</strong> privilege then they can assign ownership to other users. Now administrators have this privilege, but by default it is disabled. <a href="http://technet.microsoft.com/en-us/library/cc779180%28WS.10%29.aspx">More details on this from Microsoft</a>.</p>
<p>So to set the owner of the file, you need to have the Restore Files and Directories privilege and then enable it before setting the owner. Really we should also disable the privilege when we&#8217;ve finished using it as well.</p>
<p>Unfortunately .Net doesn&#8217;t have built in support for this yet, so we are reduced to PInvoking native methods and here&#8217;s the code:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a652d44b-c9d3-4846-bc5e-86146e359f59" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: none;"><span style="color: #0000FF;">sealed</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> UnmanagedCode
{
    [DllImport(</span><span style="color: #800000;">"</span><span style="color: #800000;">kernel32.dll</span><span style="color: #800000;">"</span><span style="color: #000000;">, SetLastError</span><span style="color: #000000;">=</span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
    [</span><span style="color: #0000FF;">return</span><span style="color: #000000;">: MarshalAs(UnmanagedType.Bool)]
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">extern</span><span style="color: #000000;"> </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> CloseHandle(IntPtr hObject);

    </span><span style="color: #008000;">//</span><span style="color: #008000;"> Use this signature if you do not want the previous state</span><span style="color: #008000;">
</span><span style="color: #000000;">    [DllImport(</span><span style="color: #800000;">"</span><span style="color: #800000;">advapi32.dll</span><span style="color: #800000;">"</span><span style="color: #000000;">, SetLastError</span><span style="color: #000000;">=</span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
    [</span><span style="color: #0000FF;">return</span><span style="color: #000000;">: MarshalAs(UnmanagedType.Bool)]
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">extern</span><span style="color: #000000;"> </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> AdjustTokenPrivileges(IntPtr tokenHandle,
        [MarshalAs(UnmanagedType.Bool)]</span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> disableAllPrivileges,
        </span><span style="color: #0000FF;">ref</span><span style="color: #000000;"> TOKEN_PRIVILEGES newState,
        UInt32 bufferLength,
        IntPtr previousState,
        IntPtr returnLength);

    [DllImport(</span><span style="color: #800000;">"</span><span style="color: #800000;">kernel32.dll</span><span style="color: #800000;">"</span><span style="color: #000000;">, ExactSpelling </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">extern</span><span style="color: #000000;"> IntPtr GetCurrentProcess();

    [DllImport(</span><span style="color: #800000;">"</span><span style="color: #800000;">advapi32.dll</span><span style="color: #800000;">"</span><span style="color: #000000;">, ExactSpelling </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">true</span><span style="color: #000000;">, SetLastError </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">extern</span><span style="color: #000000;"> </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> OpenProcessToken
        (IntPtr processHandle, </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> desiredAccess, </span><span style="color: #0000FF;">ref</span><span style="color: #000000;"> IntPtr phtok);

    [DllImport(</span><span style="color: #800000;">"</span><span style="color: #800000;">advapi32.dll</span><span style="color: #800000;">"</span><span style="color: #000000;">, SetLastError </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">extern</span><span style="color: #000000;"> </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> LookupPrivilegeValue
            (</span><span style="color: #0000FF;">string</span><span style="color: #000000;"> host, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> name, </span><span style="color: #0000FF;">ref</span><span style="color: #000000;"> LUID lpLuid);

    [StructLayout(LayoutKind.Sequential, Pack </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;">)]
    </span><span style="color: #0000FF;">struct</span><span style="color: #000000;"> TOKEN_PRIVILEGES
    {
        </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> UInt32 PrivilegeCount;
        </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> LUID Luid;
        </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> UInt32 Attributes;
    }

    [StructLayout(LayoutKind.Sequential)]
    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">struct</span><span style="color: #000000;"> LUID
    {
       </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">uint</span><span style="color: #000000;"> LowPart;
       </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> HighPart;
    }

    </span><span style="color: #0000FF;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> SE_PRIVILEGE_ENABLED </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0x00000002</span><span style="color: #000000;">;
    </span><span style="color: #0000FF;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> TOKEN_QUERY </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0x00000008</span><span style="color: #000000;">;
    </span><span style="color: #0000FF;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> TOKEN_ADJUST_PRIVILEGES </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0x00000020</span><span style="color: #000000;">;
    </span><span style="color: #008000;">//</span><span style="color: #008000; text-decoration: underline;">http://msdn.microsoft.com/en-us/library/bb530716</span><span style="color: #008000;">(VS.85).aspx</span><span style="color: #008000;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> SE_RESTORE_PRIVILEGE </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">SeRestorePrivilege</span><span style="color: #800000;">"</span><span style="color: #000000;">; 

    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> GiveRestorePrivilege()
    {
        TOKEN_PRIVILEGES tokenPrivileges;
        tokenPrivileges.PrivilegeCount </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;">;
        tokenPrivileges.Luid </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> LUID();
        tokenPrivileges.Attributes </span><span style="color: #000000;">=</span><span style="color: #000000;"> SE_PRIVILEGE_ENABLED;

        IntPtr tokenHandle </span><span style="color: #000000;">=</span><span style="color: #000000;"> RetrieveProcessToken();

        </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
        {
            </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> success </span><span style="color: #000000;">=</span><span style="color: #000000;"> LookupPrivilegeValue
                        (</span><span style="color: #0000FF;">null</span><span style="color: #000000;">, SE_RESTORE_PRIVILEGE, </span><span style="color: #0000FF;">ref</span><span style="color: #000000;"> tokenPrivileges.Luid);
            </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (success </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">false</span><span style="color: #000000;">)
            {
                </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> lastError </span><span style="color: #000000;">=</span><span style="color: #000000;"> Marshal.GetLastWin32Error();
                </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Exception(
                    </span><span style="color: #0000FF;">string</span><span style="color: #000000;">.Format(</span><span style="color: #800000;">"</span><span style="color: #800000;">Could not find privilege {0}. Error {1}</span><span style="color: #800000;">"</span><span style="color: #000000;">,
                                        SE_RESTORE_PRIVILEGE, lastError));
            }

            success </span><span style="color: #000000;">=</span><span style="color: #000000;"> AdjustTokenPrivileges(
                                                tokenHandle, </span><span style="color: #0000FF;">false</span><span style="color: #000000;">,
                                                </span><span style="color: #0000FF;">ref</span><span style="color: #000000;"> tokenPrivileges, </span><span style="color: #800080;">0</span><span style="color: #000000;">,
                                                IntPtr.Zero, IntPtr.Zero);
            </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (success </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">false</span><span style="color: #000000;">)
            {
                </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> lastError </span><span style="color: #000000;">=</span><span style="color: #000000;"> Marshal.GetLastWin32Error();
                </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Exception(
                    </span><span style="color: #0000FF;">string</span><span style="color: #000000;">.Format(</span><span style="color: #800000;">"</span><span style="color: #800000;">Could not assign privilege {0}. Error {1}</span><span style="color: #800000;">"</span><span style="color: #000000;">,
                                    SE_RESTORE_PRIVILEGE, lastError));
            }
        }
        </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
        {
            CloseHandle(tokenHandle);
        }

    }

    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> IntPtr RetrieveProcessToken()
    {
        IntPtr processHandle </span><span style="color: #000000;">=</span><span style="color: #000000;"> GetCurrentProcess();
        IntPtr tokenHandle </span><span style="color: #000000;">=</span><span style="color: #000000;"> IntPtr.Zero;
        </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> success </span><span style="color: #000000;">=</span><span style="color: #000000;"> OpenProcessToken(processHandle,
                                        TOKEN_ADJUST_PRIVILEGES </span><span style="color: #000000;">|</span><span style="color: #000000;"> TOKEN_QUERY,
                                        </span><span style="color: #0000FF;">ref</span><span style="color: #000000;"> tokenHandle);
        </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (success </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">false</span><span style="color: #000000;">)
        {
            </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> lastError </span><span style="color: #000000;">=</span><span style="color: #000000;"> Marshal.GetLastWin32Error();
            </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Exception(
                </span><span style="color: #0000FF;">string</span><span style="color: #000000;">.Format(</span><span style="color: #800000;">"</span><span style="color: #800000;">Could not retrieve process token. Error {0}</span><span style="color: #800000;">"</span><span style="color: #000000;">,
                                    lastError));
        }
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> tokenHandle;
    }
}
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>To remove the privilege you will just need to replace SE_PRIVILEGE_ENABLED with the disabled value. In my use I&#8217;m just setting the owner and finishing the process so it&#8217;s not really required.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/10/setting-the-owner-of-files-and-directories-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Mock HttpWebRequest when Unit Testing</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/10/how-to-mock-httpwebrequest-when-unit-testing/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/10/how-to-mock-httpwebrequest-when-unit-testing/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 21:34:23 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2009/10/how-to-mock-httpwebrequest-when-unit-testing/</guid>
		<description><![CDATA[One of our latest products interacts with a Restful web service. As this is the core part of its functionality as part of Test Driven Development and Unit Testing I needed to be able to test the calls to the web service using HttpWebRequest.
A quick Google didn&#8217;t come up with anything so I started looking [...]]]></description>
			<content:encoded><![CDATA[<p>One of our latest products interacts with a Restful web service. As this is the core part of its functionality as part of Test Driven Development and Unit Testing I needed to be able to test the calls to the web service using HttpWebRequest.</p>
<p>A quick Google didn&#8217;t come up with anything so I started looking at the best way to mock the calls. My initial thought was to extract all use of HttpWebRequest into a separate class, define an interface for setting the request and getting the response and use <a href="http://martinfowler.com/articles/injection.html">Dependency Injection</a> to determine whether to use the &#8216;normal&#8217; class or a mock.</p>
<p>Then I looked a bit closer at WebRequest.Create which is the method you use to create a HttpWebRequest. I noticed that it uses a <a href="http://en.wikipedia.org/wiki/Factory_method_pattern">Factory Method</a> so you could actually register your own factory object depending on the url used. So without any extra code required in the class under test, you can register your factory object and the .Net Framework will automatically use your mocks or stubs. This is pretty cool.</p>
<p>To take advantage of this you need to implement the <a href="http://msdn.microsoft.com/en-us/library/system.net.iwebrequestcreate.aspx">IWebRequestCreate interface</a> on your factory object, and then register your factory object with <a href="http://msdn.microsoft.com/en-us/library/system.net.iwebrequestcreate.aspx">WebRequest.RegisterPrefix</a>. What you do in the Create method is up to you, but I created a simple WebRequest and WebResponse pair which store the request for you to test the input, and which returns a configurable response.</p>
<p>First an example of how you can use these:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:92161342-cacd-4673-be5c-c39bad37d2dc" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: none;"><span style="color: #0000FF;">string</span><span style="color: #000000;"> response </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">my response string here</span><span style="color: #800000;">"</span><span style="color: #000000;">;
WebRequest.RegisterPrefix(</span><span style="color: #800000;">"</span><span style="color: #800000;">test</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> TestWebRequestCreate());
TestWebRequest request </span><span style="color: #000000;">=</span><span style="color: #000000;"> TestWebRequestCreate.CreateTestRequest(response);

</span><span style="color: #0000FF;">string</span><span style="color: #000000;"> url </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">test://MyUrl</span><span style="color: #800000;">"</span><span style="color: #000000;">;

ObjectUnderTest myObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> ObjectUnderTest();
myObject.Url </span><span style="color: #000000;">=</span><span style="color: #000000;"> url;
</span><span style="color: #008000;">//</span><span style="color: #008000;"> DoStuff call the url with a request and then processes the
</span><span style="color: #008000;">//</span><span style="color: #008000;"> response as set above</span><span style="color: #008000;">
</span><span style="color: #000000;">myObject.DoStuff();

</span><span style="color: #0000FF;">string</span><span style="color: #000000;"> requestContent </span><span style="color: #000000;">=</span><span style="color: #000000;"> request.ContentAsString();
Assert.AreEqual(expectedRequestContent, requestContent);
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>The code for these 3 objects is:</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:db2b1ee8-5c07-4199-a0f9-92982406f330" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: none;"><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">A web request creator for unit testing.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #0000FF;">class</span><span style="color: #000000;"> TestWebRequestCreate : IWebRequestCreate
{
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> WebRequest nextRequest;
    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">object</span><span style="color: #000000;"> lockObject </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> </span><span style="color: #0000FF;">object</span><span style="color: #000000;">();

    </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> WebRequest NextRequest
    {
        </span><span style="color: #0000FF;">get</span><span style="color: #000000;"> { </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> nextRequest ;}
        </span><span style="color: #0000FF;">set</span><span style="color: #000000;">
        {
            </span><span style="color: #0000FF;">lock</span><span style="color: #000000;"> (lockObject)
            {
                nextRequest </span><span style="color: #000000;">=</span><span style="color: #000000;"> value;
            }
        }
    }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">See </span><span style="color: #808080;">&lt;see cref="IWebRequestCreate.Create"/&gt;</span><span style="color: #008000;">.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> WebRequest Create(Uri uri)
    {
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> nextRequest;
    }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">Utility method for creating a TestWebRequest and setting
    </span><span style="color: #808080;">///</span><span style="color: #008000;"> it to be the next WebRequest to use.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #008000;">
    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;param name="response"&gt;</span><span style="color: #008000;">The response the TestWebRequest will return.</span><span style="color: #808080;">&lt;/param&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> TestWebRequest CreateTestRequest(</span><span style="color: #0000FF;">string</span><span style="color: #000000;"> response)
    {
        TestWebRequest request </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> TestWebRequest(response);
        NextRequest </span><span style="color: #000000;">=</span><span style="color: #000000;"> request;
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> request;
    }
}

</span><span style="color: #0000FF;">class</span><span style="color: #000000;"> TestWebRequest : WebRequest
{
    MemoryStream requestStream </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> MemoryStream();
    MemoryStream responseStream;

    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> Method { </span><span style="color: #0000FF;">get</span><span style="color: #000000;">; </span><span style="color: #0000FF;">set</span><span style="color: #000000;">; }
    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> ContentType { </span><span style="color: #0000FF;">get</span><span style="color: #000000;">; </span><span style="color: #0000FF;">set</span><span style="color: #000000;">; }
    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> </span><span style="color: #0000FF;">long</span><span style="color: #000000;"> ContentLength { </span><span style="color: #0000FF;">get</span><span style="color: #000000;">; </span><span style="color: #0000FF;">set</span><span style="color: #000000;">; }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">Initializes a new instance of </span><span style="color: #808080;">&lt;see cref="TestWebRequest"/&gt;</span><span style="color: #008000;">
    </span><span style="color: #808080;">///</span><span style="color: #008000;"> with the response to return.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> TestWebRequest(</span><span style="color: #0000FF;">string</span><span style="color: #000000;"> response)
    {
        responseStream </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> MemoryStream(System.Text.Encoding.UTF8.GetBytes(response));
    }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">Returns the request contents as a string.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> ContentAsString()
    {
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> System.Text.Encoding.UTF8.GetString(requestStream.ToArray());
    }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">See </span><span style="color: #808080;">&lt;see cref="WebRequest.GetRequestStream"/&gt;</span><span style="color: #008000;">.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> Stream GetRequestStream()
    {
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> requestStream;
    }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">See </span><span style="color: #808080;">&lt;see cref="WebRequest.GetResponse"/&gt;</span><span style="color: #008000;">.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> WebResponse GetResponse()
    {
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> TestWebReponse(responseStream);
    }
}

</span><span style="color: #0000FF;">class</span><span style="color: #000000;"> TestWebReponse : WebResponse
{
    Stream responseStream;

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">Initializes a new instance of </span><span style="color: #808080;">&lt;see cref="TestWebReponse"/&gt;</span><span style="color: #008000;">
    </span><span style="color: #808080;">///</span><span style="color: #008000;"> with the response stream to return.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> TestWebReponse(Stream responseStream)
    {
        </span><span style="color: #0000FF;">this</span><span style="color: #000000;">.responseStream </span><span style="color: #000000;">=</span><span style="color: #000000;"> responseStream;
    }

    </span><span style="color: #808080;">///</span><span style="color: #008000;"> </span><span style="color: #808080;">&lt;summary&gt;</span><span style="color: #008000;">See </span><span style="color: #808080;">&lt;see cref="WebResponse.GetResponseStream"/&gt;</span><span style="color: #008000;">.</span><span style="color: #808080;">&lt;/summary&gt;</span><span style="color: #808080;">
</span><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> Stream GetResponseStream()
    {
        </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> responseStream;
    }
}
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>This is quite a simple implementation, just to check the request and return a known response. Once you&#8217;ve got this working, you can obviously do more tests such as simulating error conditions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/10/how-to-mock-httpwebrequest-when-unit-testing/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Memory Leaks in My Planner Web Part</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/06/memory-leaks-in-my-planner-web-part/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/06/memory-leaks-in-my-planner-web-part/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 00:12:50 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Microsoft Learning Gateway]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2009/06/memory-leaks-in-my-planner-web-part/</guid>
		<description><![CDATA[Just spent an evening hunting down and fixing memory leaks in the MLG My Planner web part. The code was opening SPSite and SPWeb objects and then not disposing them. Level 101 error by whoever wrote it!
The layout of the code is a bit bizarre. There’s the main web part project, and 6 other supporting [...]]]></description>
			<content:encoded><![CDATA[<p>Just spent an evening hunting down and fixing memory leaks in the MLG My Planner web part. The code was opening SPSite and SPWeb objects and then not disposing them. Level 101 error by whoever wrote it!</p>
<p>The layout of the code is a bit bizarre. There’s the main web part project, and 6 other supporting projects, all of which are required by the web part, but not used by another other project. They each only contain 1 or 2 files. This is totally unnecessary and leads to having to ship 6 extra dlls. When I get a bit more time to work on it I’ll have to combine them all into one dll.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/06/memory-leaks-in-my-planner-web-part/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Sql Table Names and Case-Sensitivity</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/06/my-sql-table-names-and-case-sensitivity/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/06/my-sql-table-names-and-case-sensitivity/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 12:46:45 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Learning Gateway Conference]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/index.php/2009/06/my-sql-table-names-and-case-sensitivity/</guid>
		<description><![CDATA[While implementing the generate quote page for the Learning Gateway Conference I was storing the quote details in a My Sql database. Normally I use Sql Server, but that’s an optional extra on my hosting plan, so I went for MySql which is included, thinking how different can it be. I’d already got had some [...]]]></description>
			<content:encoded><![CDATA[<p>While implementing the generate quote page for the <a href="http://www.learninggatewayconference.com/">Learning Gateway Conference</a> I was storing the quote details in a My Sql database. Normally I use Sql Server, but that’s an optional extra on my hosting plan, so I went for MySql which is included, thinking how different can it be. I’d already got had some experience of working with it while integrating with <a href="http://www.salamandersoft.co.uk/moodle.html">Moodle</a>.</p>
<p>So I had everything up an running nicely on my development server, until I uploaded the code to the live server, then suddenly, bang, the database calls stopped working with the exceptions talking about an invalid query. I finally tracked it down to the case-sensitivity of the table names in MySql. In windows, the table names are case-insensitive, while on Linux the table names are case-sensitive, and my ISP hosts the MySql databases on Linux machines.</p>
<p>The most annoying thing is that I’m normally very careful about case-sensitivity, but didn’t pay attention to it in this specific case. Moral of the story is always be case-sensitive when coding even if you don’t have to be.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/06/my-sql-table-names-and-case-sensitivity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting SPControls.DateTimeControl to display the local date format</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/05/getting-spcontrolsdatetimecontrol-to-display-the-local-date-format/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/05/getting-spcontrolsdatetimecontrol-to-display-the-local-date-format/#comments</comments>
		<pubDate>Fri, 29 May 2009 09:35:47 +0000</pubDate>
		<dc:creator>RichardWillis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SLK]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/2009/05/29/GettingSPControlsDateTimeControlToDisplayTheLocalDateFormat.aspx</guid>
		<description><![CDATA[One of the minor problems with SLK was that on the Assignment Properties page the Start and Due dates were always being shown in US format, no matter what the regional setting were. There was a really simple fix, you just need to set the LocaleId of the DateTimeControl and then it will display the [...]]]></description>
			<content:encoded><![CDATA[<p>One of the minor problems with SLK was that on the Assignment Properties page the Start and Due dates were always being shown in US format, no matter what the regional setting were. There was a really simple fix, you just need to set the LocaleId of the DateTimeControl and then it will display the date in the regional format of the site.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spDateTimeStart.LocaleId = SPWeb.Locale.LCID;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spDateTimeDue.LocaleId = SPWeb.Locale.LCID;</p>
<p>A version with this fix in is now available on the <a href="http://slk.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=23487">1.3.2 build page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/05/getting-spcontrolsdatetimecontrol-to-display-the-local-date-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running IIS application pool as a domain user</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/03/running-iis-application-pool-as-a-domain-user/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/03/running-iis-application-pool-as-a-domain-user/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:30:22 +0000</pubDate>
		<dc:creator>RichardWillis</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/2009/03/25/RunningIISApplicationPoolAsADomainUser.aspx</guid>
		<description><![CDATA[Just finished setting up an IIS application pool to run as a domain user. There&#8217;s a number of hurdles you have to jump over before it will work.

In local policies, set the account to &#8220;Act as part of the operating system&#8221;. Administrative Tools &#124; Local Security Settings &#124; Local Policies &#124; User Rights Assignments &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Just finished setting up an IIS application pool to run as a domain user. There&#8217;s a number of hurdles you have to jump over before it will work.</p>
<ol>
<li>In local policies, set the account to &#8220;Act as part of the operating system&#8221;. Administrative Tools | Local Security Settings | Local Policies | User Rights Assignments | Act as part of the operating system</li>
<li>In local policies, set the account to log on as a service.</li>
<li>Give the account Modify permissions on the folders asp.net uses to create it&#8217;s temporary files.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/03/running-iis-application-pool-as-a-domain-user/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint Manager 2007</title>
		<link>http://blog.salamandersoft.co.uk/index.php/2009/03/sharepoint-manager-2007/</link>
		<comments>http://blog.salamandersoft.co.uk/index.php/2009/03/sharepoint-manager-2007/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 14:02:53 +0000</pubDate>
		<dc:creator>RichardWillis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://blog.salamandersoft.co.uk/2009/03/03/SharePointManager2007.aspx</guid>
		<description><![CDATA[I&#8217;ve just come across a great free tool for SharePoint 2007. It&#8217;s SharePoint Manager 2007 and is hosted over at CodePlex. It&#8217;s quite simply an object model explorer for SharePoint, allowing you to drill down into any detail of SharePoint, from server properties, to web users even down to individual list items. It will even [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just come across a great free tool for SharePoint 2007. It&#8217;s <a href="http://www.codeplex.com/spm">SharePoint Manager 2007</a> and is hosted over at CodePlex. It&#8217;s quite simply an object model explorer for SharePoint, allowing you to drill down into any detail of SharePoint, from server properties, to web users even down to individual list items. It will even let you modify the properties if you&#8217;re feeling brave.</p>
<p>I&#8217;ve lost count of all the little console utilities I&#8217;ve written to dump things like list fields, view CAML etc, all of which you can browse to with the tool. I think that it&#8217;s going to save me a lot of time and increase my knowledge of SharePoint.</p>
<p><img src="http://blog.salamandersoft.co.uk/content/binary/spm.PNG" border="0"></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.salamandersoft.co.uk/index.php/2009/03/sharepoint-manager-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
