<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6324323728367352122</id><updated>2012-02-16T06:27:28.100-08:00</updated><title type='text'>Convert.ToString();</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.converttostring.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-4067301805997721436</id><published>2007-03-06T12:28:00.000-08:00</published><updated>2007-06-28T17:25:40.901-07:00</updated><title type='text'>Custom Site Definition, Solution Package, App_GlobalResource &amp; Web.Config</title><content type='html'>&lt;P&gt;It was hard to come up with a good title for a this post, but this one will do I guess. Solution packages are one of the greatest features in MOSS 2007, and for a while (up until 2 minutes ago) I was kind of anoyed that the solution packages provided no way to modify the Web.config, or to get a *.resx file into the App_GlobalResources folder. Well I just found a way to accomplish these tasks, but it really (kinda) only works if you are creating a site definition that will be deployed before the Web Application is created. Here is how you perform these two tasks:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;U&gt;Modify the Web.config&lt;/U&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Have a read of the link below and when you are done modify your solution package to drop of your custom webconfig.*.xml file off in the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG folder&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/ms439965.aspx"&gt;How to: Add Custom Configuration Settings for Extending Virtual Servers&lt;/A&gt; &lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;U&gt;Add a *.resx file to App_GlobalResources folder&lt;/U&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Following the lead from the article above, I discovered that you just need to create your *.resx file and get your solution package to drop it off in the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\Resources folder.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;So, when you create a new Web Application the webconfig.*.xml file will be merged with the Web.config file of the site, and the *.resx file will be dropped off in the App_GlobalResources file.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;The downsides of this solution are :&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;LI&gt;The Web.config entries and the *.resx file will be added to all web applications regardless of whether your site definition is being added to it. &lt;br /&gt;&lt;LI&gt;This solution will not work for web parts, or features, or anything else really, because the files need to be dropped off before the Web Application is created. &lt;br /&gt;&lt;LI&gt;When you remove the solution package from SharePoint the entries are left in the Web.config and the *.resx files are left in the App_GlobalResources.&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P&gt;I think the solution packages should be an extensible framework, in the same way as we have feature handlers, so that you can deploy anything to anywhere and then have it cleaned up when you remove it.&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-4067301805997721436?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/4067301805997721436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=4067301805997721436' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4067301805997721436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4067301805997721436'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2007/03/custom-site-definition-solution-package.html' title='Custom Site Definition, Solution Package, App_GlobalResource &amp; Web.Config'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-5643599145206709283</id><published>2007-03-01T21:52:00.000-08:00</published><updated>2007-06-28T17:13:20.312-07:00</updated><title type='text'>Team Foundation Server Web Services</title><content type='html'>&lt;P&gt;I searched everywhere trying to find a list of the web services that surround TFS, and I only discovered them because I found the url of one web server which had a function that listed all of them. Anyway, just to make it easy for others, here they are:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;U&gt;TFS Web Services&lt;/U&gt;&lt;BR&gt;/Services/v1.0/AuthorizationService.asmx&lt;BR&gt;/Services/v1.0/CommonStructureService.asmx&lt;BR&gt;/Services/v1.0/EventService.asmx&lt;BR&gt;/Services/v1.0/GroupSecurityService.asmx&lt;BR&gt;/Services/v1.0/ProjectMaintenance.asmx&lt;BR&gt;/Services/v1.0/ProcessTemplate.asmx&lt;BR&gt;/Services/v1.0/Registration.asmx&lt;BR&gt;/Services/v1.0/ServerStatus.asmx&lt;/P&gt;&lt;br /&gt;&lt;P&gt;/Warehouse/v1.0/WarehouseController.asmx&lt;BR&gt;/Warehouse/v1.0/WarehouseController.asmx&lt;BR&gt;&lt;BR&gt;/Build/v1.0/BuildStore.asmx&lt;BR&gt;/Build/v1.0/BuildController.asmx&lt;BR&gt;/Build/v1.0/Integration.asmx&lt;BR&gt;/Build/v1.0/Integration.asmx&lt;BR&gt;/Build/v1.0/Integration.asmx&lt;BR&gt;/Build/v1.0/PublishTestResultsBuildService.asmx&lt;/P&gt;&lt;br /&gt;&lt;P&gt;/WorkItemTracking/v1.0/ClientService.asmx&lt;BR&gt;/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx&lt;BR&gt;/WorkItemTracking/v1.0/Integration.asmx&lt;BR&gt;/WorkItemTracking/v1.0/Integration.asmx&lt;BR&gt;/WorkItemTracking/v1.0/Integration.asmx&lt;BR&gt;/WorkItemTracking/v1.0/Integration.asmx&lt;BR&gt;&lt;BR&gt;/VersionControl/v1.0/repository.asmx&lt;BR&gt;/VersionControl/v1.0/administration.asmx&lt;BR&gt;/VersionControl/v1.0/integration.asmx&lt;BR&gt;/VersionControl/v1.0/integration.asmx&lt;BR&gt;/VersionControl/v1.0/integration.asmx&lt;BR&gt;/VersionControl/v1.0/item.asmx&lt;BR&gt;/VersionControl/v1.0/upload.asmx&lt;BR&gt;&lt;BR&gt;/Build/v1.0/PublishTestResultsBuildService.asmx&lt;BR&gt;/Build/v1.0/PublishTestResultsBuildService.asmx&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;U&gt;Reporting Services Web Services&lt;/U&gt;&lt;BR&gt;&lt;A href="https://[report_server_url]/ReportServer/ReportService.asmx"&gt;https://[report_server_url]/ReportServer/ReportService.asmx&lt;/A&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;U&gt;WSS Web Services&lt;/U&gt;&lt;BR&gt;&lt;A href="https://[wss_central_admin_url]/_vti_adm/admin.asmx"&gt;https://[wss_central_admin_url]/_vti_adm/admin.asmx&lt;/A&gt;&lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/alerts.asmx"&gt;http://[wss_url]/_vti_bin/alerts.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/dws.asmx"&gt;http://[wss_url]/_vti_bin/dws.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/forms.asmx"&gt;http://[wss_url]/_vti_bin/forms.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/imaging.asmx"&gt;http://[wss_url]/_vti_bin/imaging.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/dspsts.asmx"&gt;http://[wss_url]/_vti_bin/dspsts.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/lists.asmx"&gt;http://[wss_url]/_vti_bin/lists.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/meetings.asmx"&gt;http://[wss_url]/_vti_bin/meetings.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/permissions.asmx"&gt;http://[wss_url]/_vti_bin/permissions.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/sitedata.asmx"&gt;http://[wss_url]/_vti_bin/sitedata.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/sites.asmx"&gt;http://[wss_url]/_vti_bin/sites.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/usergroup.asmx"&gt;http://[wss_url]/_vti_bin/usergroup.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/versions.asmx"&gt;http://[wss_url]/_vti_bin/versions.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/views.asmx"&gt;http://[wss_url]/_vti_bin/views.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/webpartpages.asmx"&gt;http://[wss_url]/_vti_bin/webpartpages.asmx&lt;/A&gt; &lt;BR&gt;&lt;A href="http://[wss_url]/_vti_bin/webs.asmx"&gt;http://[wss_url]/_vti_bin/webs.asmx&lt;/A&gt; &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-5643599145206709283?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/5643599145206709283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=5643599145206709283' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/5643599145206709283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/5643599145206709283'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2007/03/team-foundation-server-web-services.html' title='Team Foundation Server Web Services'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-3104901746286777032</id><published>2007-02-27T20:41:00.000-08:00</published><updated>2007-06-28T17:24:51.306-07:00</updated><title type='text'>Brainstem Development</title><content type='html'>&lt;p&gt;I am currently doing some robotics development using the &lt;a href="http://www.acroname.com/robotics/parts/S1-GP-BRD.html"&gt;Brainstem&lt;/a&gt; microcontroller from &lt;a href="http://www.acroname.com/"&gt;Acroname&lt;/a&gt;. I used to talk to it using a serial cable, but then I got a new machine which didn't have a serial port, so I decided to go down the USB road, because serial cables are so 1970s. Acroname do sell a usb &lt;a href="http://www.acroname.com/robotics/parts/S19-USB-SERIAL-INT-CONN.html"&gt;module&lt;/a&gt; that is designed specifically for the Brainstem, but I get sick of paying more for shipping and duty than the product I am buying. So I purchased a &lt;a href="http://www.hvwtech.com/products_view.asp?CatID=163&amp;SubCatID=197&amp;amp;SubSubCatID=231&amp;ProductID=409"&gt;USB to TTL Serial Adapter&lt;/a&gt; from &lt;a href="http://www.hvwtech.com/"&gt;HVWTech&lt;/a&gt;, a company out of Calgary, and I actually got it hooked up and running pretty easily. I thought I would upload a few pictures incase anyone out there is thinking about doing this kind of thing and is a bit unsure how to go about it, as there is not a whole lot of info about the Brainstem on the web.&lt;br /&gt; &lt;a href="http://farm2.static.flickr.com/1253/654496910_e80fa75ae2.jpg" target="_blank"&gt;&lt;img src="http://farm2.static.flickr.com/1253/654496910_e80fa75ae2.jpg" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://farm2.static.flickr.com/1246/654496992_ae0f77b979.jpg" target="_blank"&gt;&lt;img src="http://farm2.static.flickr.com/1246/654496992_ae0f77b979.jpg" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://farm2.static.flickr.com/1434/654496938_c711753a63.jpg" target="_blank"&gt;&lt;img src="http://farm2.static.flickr.com/1434/654496938_c711753a63.jpg" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Brainstem Links&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www.bespokesoftware.org/wordpress/?page_id=8"&gt;Great .NET API from Bespoke Software&lt;/a&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://cylonrobot.blogspot.com/2004/09/few-pictures-of-cylon.html"&gt;Cylon Robot&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-3104901746286777032?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/3104901746286777032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=3104901746286777032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/3104901746286777032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/3104901746286777032'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2007/02/brainstem-development.html' title='Brainstem Development'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm2.static.flickr.com/1253/654496910_e80fa75ae2_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-2634805482660720101</id><published>2006-12-17T19:12:00.000-08:00</published><updated>2007-06-28T17:13:21.567-07:00</updated><title type='text'>Changing the masterpage of individual pages in SharePoint/MOSS 2007</title><content type='html'>It is possible to change the masterpage of a page in SharePoint/MOSS 2007 by using SharePoint Designer or by adjusting the values of the ~masterurl/default.master and the ~masterurl/custom.master. But what if you want to be able to change a page without using the designer and what if you want your page to use a different masterpage besides the two mentioned above, or even switch them. The snippet of code below will allow you to do it. Unfortunately when you get a SPFile object you cannot just cast it into an aspx page and change its masterpage value, so the code snippet downloads the file, finds the MasterPageFile attribute by using a regular expression, changes it and uploads it again. This piece of code would probably be best used by turning it into a webpart or a control in the settings areas of a website, which would list pages and then the master pages you could apply to them.  &lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;Uri fileUri = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; &lt;br /&gt;Uri(&lt;SPAN class=str&gt;"http://mysite:26195/mysubweb/Documents/Forms/AllItems.aspx"&lt;/SPAN&gt;);&lt;br /&gt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; masterPageRegEx = &lt;SPAN class=str&gt;@"MasterPageFile="&lt;/SPAN&gt;&lt;SPAN class=str&gt;"[^"&lt;/SPAN&gt;&lt;SPAN class=str&gt;"]*"&lt;/SPAN&gt;&lt;SPAN class=str&gt;""&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; masterPageUpdate = &lt;SPAN class=str&gt;"MasterPageFile=\"{0}\""&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; masterPage = &lt;br /&gt;&lt;SPAN class=str&gt;"~SiteCollection/_catalogs/masterpage/mymaster.master"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;&lt;SPAN class=rem&gt;//string masterPage = "~masterurl/default.master";&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN class=rem&gt;//string masterPage = "~masterurl/custom.master";&lt;/SPAN&gt;&lt;br /&gt;&lt;br /&gt;SPSecurity.RunWithElevatedPrivileges(&lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;()&lt;br /&gt;{&lt;br /&gt;    &lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; (SPSite site = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; SPSite(fileUri.OriginalString))&lt;br /&gt;    {&lt;br /&gt;        &lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; (SPWeb associatedWeb = site.OpenWeb())&lt;br /&gt;        {&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; folderName = &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;.Empty;&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;for&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; i = 0; i &lt; fileUri.Segments.Length - 1; i++)&lt;br /&gt;                folderName += fileUri.Segments[i];&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///the GetFolder function does not like it while &lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///the folder path begins with a '/' so we remove &lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///it here&lt;/SPAN&gt;&lt;br /&gt;            folderName = folderName.Replace(&lt;br /&gt;            associatedWeb.ServerRelativeUrl + &lt;SPAN class=str&gt;"/"&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;.Empty);&lt;br /&gt;&lt;br /&gt;            SPFolder folder = associatedWeb.GetFolder(folderName);&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (folder != &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)&lt;br /&gt;            {&lt;br /&gt;                &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; fileName = &lt;br /&gt;                fileUri.Segments[fileUri.Segments.Length - 1];&lt;br /&gt;                SPFile f = folder.Files[fileName];&lt;br /&gt;&lt;br /&gt;                &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (f.Exists)&lt;br /&gt;                {&lt;br /&gt;                    &lt;SPAN class=rem&gt;///download the file and convert it to a string&lt;/SPAN&gt;&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;byte&lt;/SPAN&gt;[] file = f.OpenBinary();&lt;br /&gt;                    System.Text.Encoding enc = System.Text.Encoding.ASCII;&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; myString = enc.GetString(file);&lt;br /&gt;&lt;br /&gt;                    RegexOptions options = RegexOptions.None;&lt;br /&gt;                    Regex regex = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Regex(masterPageRegEx, options);&lt;br /&gt;&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; result = regex.Replace(myString, &lt;br /&gt;                    &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;.Format(masterPageUpdate, masterPage));&lt;br /&gt;&lt;br /&gt;                    &lt;SPAN class=rem&gt;///I have found that sometimes the file ends &lt;/SPAN&gt;&lt;br /&gt;                    &lt;SPAN class=rem&gt;///up starting with '???', this will cause&lt;/SPAN&gt;&lt;br /&gt;                    &lt;SPAN class=rem&gt;///problems if you upload it like this, so &lt;/SPAN&gt;&lt;br /&gt;                    &lt;SPAN class=rem&gt;///this makes sure the file begins as it should&lt;/SPAN&gt;&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;while&lt;/SPAN&gt; (result[0] != &lt;SPAN class=str&gt;'&lt;'&lt;/SPAN&gt;)&lt;br /&gt;                        result = result.Remove(0, 1);&lt;br /&gt;&lt;br /&gt;                    &lt;SPAN class=rem&gt;///turn the file back into a byte array to we can upload it&lt;/SPAN&gt;&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;byte&lt;/SPAN&gt;[] myByteArray = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;byte&lt;/SPAN&gt;[result.Length];&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; i = 0;&lt;br /&gt;                    &lt;SPAN class=kwrd&gt;foreach&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;char&lt;/SPAN&gt; c &lt;SPAN class=kwrd&gt;in&lt;/SPAN&gt; result.ToCharArray())&lt;br /&gt;                    {&lt;br /&gt;                        myByteArray[i] = (&lt;SPAN class=kwrd&gt;byte&lt;/SPAN&gt;)c;&lt;br /&gt;                        i++;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    &lt;SPAN class=rem&gt;///add the file to the folder&lt;/SPAN&gt;&lt;br /&gt;                    folder.Files.Add(fileName, myByteArray, &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;});&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-2634805482660720101?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/2634805482660720101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=2634805482660720101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2634805482660720101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2634805482660720101'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/12/changing-masterpage-of-individual-pages.html' title='Changing the masterpage of individual pages in SharePoint/MOSS 2007'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-4380084830817935389</id><published>2006-12-12T20:52:00.000-08:00</published><updated>2007-06-28T17:13:22.082-07:00</updated><title type='text'>Stopping the ASP.Net Web Site Administration Tool adding a namespace to your web.config</title><content type='html'>&lt;P&gt;There is a bug in ASP.NET 2.0 (I don't know if this is a problem in v1.1) which causes some things to go a bit crazy if you add the http://schemas.microsoft.com/.NetConfiguration/v2.0 namespace to the configuration node of your web.config. I don't think many people go out of their way to add this into the web.config but it can be added in by other applications, such as the ASP.Net Web Site Administration Tool.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;One way to stop it from adding this in is by modifying the WebAdminPage.cs class of the ASP.Net Web Site Administration Tool (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\). The function below is used to save the web.config, and you will notice the NamespaceDeclared property on the Configuration is allways set to be true. This is where the problem is. &lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; SaveConfig(Configuration config) {&lt;br /&gt;    RemotingManager.ShutdownTargetApplication();&lt;br /&gt;    config.NamespaceDeclared = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;SPAN class=rem&gt;// check if session expired&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (String.IsNullOrEmpty(ApplicationPath) || &lt;br /&gt;           String.IsNullOrEmpty((&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)Session[APP_PHYSICAL_PATH])) {&lt;br /&gt;        Server.Transfer(&lt;SPAN class=str&gt;"~/home2.aspx"&lt;/SPAN&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    config.Save(ConfigurationSaveMode.Minimal);&lt;br /&gt;}&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;If you change the statement from...&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;config.NamespaceDeclared = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;&lt;br /&gt;&lt;B&gt;to&lt;/B&gt;&lt;br /&gt;config.NamespaceDeclared = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;...the namespace will no longer be added to the web.config. I have not found anyside side-effects to making this change.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;This may also help you solve the problem in SharePoint/MOSS 2007 where you suddenly get alot of File Not Found errors on pages and errors in your Event Log looking for the Microsoft.SharePoint, Version=11.0.0.0... dll (see the following post &lt;A href="http://www.infusionblogs.com/blogs/kguenther/archive/2006/06/27/608.aspx"&gt;http://www.infusionblogs.com/blogs/kguenther/archive/2006/06/27/608.aspx&lt;/A&gt; for more info.)&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-4380084830817935389?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/4380084830817935389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=4380084830817935389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4380084830817935389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4380084830817935389'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/12/stopping-aspnet-web-site-administration.html' title='Stopping the ASP.Net Web Site Administration Tool adding a namespace to your web.config'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-4141033991711168344</id><published>2006-12-12T20:35:00.000-08:00</published><updated>2007-06-28T17:13:22.546-07:00</updated><title type='text'>SharePoint 2007 anonymous user access permissions</title><content type='html'>&lt;P&gt;I am currently working with a MOSS 2007 site which has anonymous access and uses forms authentication with the AspNetSqlMembershipProvider. For some reason anonymous users were able to get the Forms pages belonging to lists i.e. ListName/Forms/AllItems.aspx etc. I did not want anonymous users to be able to access these areas, and I expected them to be redirected to the login screen if they tried to access them. I created a site using the Publishing site definition and it had the desired functionality, but for some reason my own site definition would not obey this rule. &lt;/P&gt;&lt;br /&gt;&lt;P&gt;After some investigation it turned out that the problem was occuring because an extra permission (&lt;SPAN class=csharpcode&gt;SPBasePermissions.ViewFormPages&lt;/SPAN&gt;) had been added to the Anonymous Permission mMsk for the web, allowing anonymous users access to the Form pages. To fix the problem all I had to do was run the code below to remove the &lt;SPAN class=csharpcode&gt;SPBasePermissions.ViewFormPages&lt;/SPAN&gt; permission and reset the Anonymous Permission Mask to its default state. I am still unsure as to what added in the extra permission because my site was a direct copy of the Publishing site definition. I have a feeling it maybe related to the stsadm tool which I used to create the site and all of its configurations.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;/P&gt;&lt;PRE class=csharpcode&gt;SPSecurity.RunWithElevatedPrivileges(&lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;()&lt;br /&gt;{&lt;br /&gt;    &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; siteUrl = &lt;SPAN class=str&gt;"http://mysite"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; (SPSite site = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; SPSite(siteUrl))&lt;br /&gt;    {&lt;br /&gt;        SPWebCollection webs = site.AllWebs;&lt;br /&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;foreach&lt;/SPAN&gt; (SPWeb web &lt;SPAN class=kwrd&gt;in&lt;/SPAN&gt; webs)&lt;br /&gt;        {&lt;br /&gt;            &lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; (web)&lt;br /&gt;            {&lt;br /&gt;                &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (web.HasUniqueRoleAssignments)&lt;br /&gt;                {&lt;br /&gt;                    web.AnonymousPermMask64 = SPBasePermissions.ViewListItems |&lt;br /&gt;                                                SPBasePermissions.ViewVersions |&lt;br /&gt;                                                SPBasePermissions.Open |&lt;br /&gt;                                                SPBasePermissions.ViewPages |&lt;br /&gt;                                                SPBasePermissions.UseClientIntegration;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;});&lt;br /&gt;&lt;/PRE&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-4141033991711168344?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/4141033991711168344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=4141033991711168344' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4141033991711168344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4141033991711168344'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/12/sharepoint-2007-anonymous-user-access.html' title='SharePoint 2007 anonymous user access permissions'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-4323244909765834537</id><published>2006-12-04T09:24:00.000-08:00</published><updated>2007-06-28T17:13:22.983-07:00</updated><title type='text'>How to impersonate a Forms user</title><content type='html'>&lt;P&gt;Impersonating a Windows account can be quite easy especially if you have seen great articles such as this &lt;A href="http://dotnetjunkies.com/WebLog/victorv/archive/2005/06/30/128890.aspx"&gt;http://dotnetjunkies.com/WebLog/victorv/archive/2005/06/30/128890.aspx&lt;/A&gt; . But there is less discussion about impersonating forms users, and it took me quite a while to figure out how to do it. With a little inspiration from the &lt;A href="http://www.eggheadcafe.com/articles/20020906.asp"&gt;FormsAuthentication, Identities and Role - based Security with a database&lt;/A&gt; article by Peter A. Bromberg. This is handy if you are using something like the AspNetSqlMembershipProvider. You could set this up a bit better and build a class in a similar way to Victor Vogelpoel did in the link above. &lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;IPrincipal _originalUser = HttpContext.Current.User;&lt;br /&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;&lt;br /&gt;{&lt;br /&gt;	System.Web.HttpCookie c = &lt;br /&gt;	System.Web.Security.FormsAuthentication.GetAuthCookie&lt;br /&gt;	("Administrator", false);&lt;br /&gt;				&lt;br /&gt;	FormsAuthenticationTicket a = &lt;br /&gt;	&lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; FormsAuthenticationTicket(&lt;br /&gt;	LandingPageSettings.Settings.FormsUser, &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;, 1000);&lt;br /&gt;				&lt;br /&gt;	FormsIdentity b = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; FormsIdentity(a);&lt;br /&gt;&lt;br /&gt;	&lt;SPAN class=rem&gt;// Get Forms Ticket From Identity object&lt;/SPAN&gt;&lt;br /&gt;	FormsAuthenticationTicket ticket = b.Ticket;&lt;br /&gt;&lt;br /&gt;	&lt;SPAN class=rem&gt;// Retrieve stored user-data (our roles from db)&lt;/SPAN&gt;&lt;br /&gt;	&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; userData = ticket.UserData;&lt;br /&gt;	&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;[] roles = userData.Split(&lt;SPAN class=str&gt;','&lt;/SPAN&gt;);&lt;br /&gt;&lt;br /&gt;	&lt;SPAN class=rem&gt;// Create a new Generic Principal Instance&lt;/SPAN&gt;&lt;br /&gt;	&lt;SPAN class=rem&gt;// and assign to Current User&lt;/SPAN&gt;&lt;br /&gt;	HttpContext.Current.User = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; GenericPrincipal(b, roles);&lt;br /&gt;&lt;br /&gt;	//your code goes here&lt;br /&gt;}&lt;br /&gt;&lt;SPAN class=kwrd&gt;finally&lt;/SPAN&gt;&lt;br /&gt;{&lt;br /&gt;	HttpContext.Current.User = _originalUser;&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-4323244909765834537?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/4323244909765834537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=4323244909765834537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4323244909765834537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4323244909765834537'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/12/how-to-impersonate-forms-user.html' title='How to impersonate a Forms user'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-7133004234880761162</id><published>2006-12-04T09:03:00.000-08:00</published><updated>2007-06-28T17:13:23.304-07:00</updated><title type='text'>Impersonation in SharePoint 2007</title><content type='html'>&lt;P&gt;One of the major pain points for me in SharePoint 2003 was having to impersonate a user who had almighty powers so I could achieve some mere mortal functionality for a regular user. Usually you would end up impersonating the App Pool or putting an entry in the web.config file with a user name and password to use, and then do your magic from there. One place you would have to do this was if you wanted to check a users permissions, no, no, you can't do that, unless you have godly powers. I hoped this would be fixed in 2007, and it wasn't, but what I found out instead was far awesomerer. What I found was this &lt;A href="http://msdn2.microsoft.com/en-us/library/aa543467.aspx"&gt;Elevation of Privilege&lt;/A&gt; . Microsoft listened and all was good.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;All you have to do is stick your code inside this block and all will be fine, your code will now run with the permissions it needs.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;SPSecurity.RunWithElevatedPrivileges(&lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;()&lt;br /&gt;{&lt;br /&gt;    &lt;SPAN class=rem&gt;// do things assuming the permission of the "system account"&lt;/SPAN&gt;&lt;br /&gt;});&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-7133004234880761162?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/7133004234880761162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=7133004234880761162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/7133004234880761162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/7133004234880761162'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/12/impersonation-in-sharepoint-2007.html' title='Impersonation in SharePoint 2007'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-2367478545035971714</id><published>2006-10-16T07:20:00.000-07:00</published><updated>2007-06-28T17:13:23.637-07:00</updated><title type='text'>SharePoint 2007 ONET.xml AlternateHeader</title><content type='html'>&lt;P&gt;This is true for SharePoint 2007 B2 TR1:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Even though &lt;STRONG&gt;AlternateHeader&lt;/STRONG&gt; does not show up in the schema for ONET.xml, you can still use it in the same way you would in SharePoint 2003. The only difference this time is that MS has bundled the alternate header logic into a control (see below). As far as I can see this control is only present on pages that use the application.master i.e. any pages that live under /_layouts/..., so you will have to add it to your master pages to get a consistant look around your site.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;%@ Register TagPrefix="wssuc" TagName="TopNavBar" src="~/_controltemplates/TopNavBar.ascx" %&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;wssuc:TopNavBar id="IdTopNavBar" runat="server" ShouldUseExtra="true"/&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-2367478545035971714?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/2367478545035971714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=2367478545035971714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2367478545035971714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2367478545035971714'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/10/sharepoint-2007-onetxml-alternateheader.html' title='SharePoint 2007 ONET.xml AlternateHeader'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-8824142781183155135</id><published>2006-10-10T11:44:00.000-07:00</published><updated>2007-06-28T17:13:23.938-07:00</updated><title type='text'>Moss 2007: File Not Found error on Login.aspx page when using anonymous access</title><content type='html'>&lt;P&gt;This post saved my sanity, hopefully it will save yours. If you have experienced the File Not Found error on the Login.aspx page when using anonymous access this will solve your problem.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;A href="http://www.infusionblogs.com/blogs/kguenther/archive/2006/06/27/608.aspx"&gt;http://www.infusionblogs.com/blogs/kguenther/archive/2006/06/27/608.aspx&lt;/A&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-8824142781183155135?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/8824142781183155135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=8824142781183155135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/8824142781183155135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/8824142781183155135'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/10/moss-2007-file-not-found-error-on.html' title='Moss 2007: File Not Found error on Login.aspx page when using anonymous access'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-5452301833236801049</id><published>2006-10-08T21:16:00.000-07:00</published><updated>2007-06-28T17:13:24.693-07:00</updated><title type='text'>Using the ASP.NET Web Site Administration Tool with IIS</title><content type='html'>&lt;P&gt;On this Canadian Thankgiving weekend my thoughts take me through the year gone by, and I wonder...Where did my "The Internet Is Awesome!" t-shirt go?...Why am I still waiting for the final installment of the Seinfeld DVDs to be released?...and Why the hell can I not get the ASP.NET Web Site Administration Tool to work on any IIS web site except for the Default Web Site?&lt;/P&gt;&lt;br /&gt;&lt;P&gt;This is a question one hell of a lot of people have been asking, anyone who tries to do this on any site except for the Default Web Site ends up with the following error:&lt;/P&gt;&lt;br /&gt;&lt;DIV&gt;&lt;br /&gt;&lt;P&gt;An error was encountered. Please return to the previous page and try again. &lt;BR&gt;&lt;BR&gt;&lt;SPAN id=exceptionMessageLabel0&gt;The following message may help in diagnosing the problem: &lt;/SPAN&gt;&lt;/P&gt;&lt;br /&gt;&lt;DIV style="FONT-WEIGHT: bold"&gt;System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: site at System.Web.Configuration.WebConfigurationHost.InitForConfiguration(String&amp; locationSubPath, String&amp; configPath, String&amp; locationConfigPath, IInternalConfigRoot configRoot, Object[] hostInitConfigurationParams) at System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams) at System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.&lt;BR&gt;IInternalConfigConfigurationFactory.Create(Type typeConfigHost, Object[] hostInitConfigurationParams) at System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel, ConfigurationFileMap fileMap, VirtualPath path, String site, String locationSubPath, String server, String userName, String password, IntPtr tokenHandle) at System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl(WebLevel webLevel, ConfigurationFileMap fileMap, String path, String site, String locationSubPath, String server, String userName, String password, IntPtr userToken) at System.Web.Configuration.WebConfigurationManager.OpenMappedWebConfiguration(WebConfigurationFileMap fileMap, String path) at System.Web.Administration.WebAdminPage.OpenWebConfiguration(String path, String appPhysPath, Boolean getWebConfigForSubDir) at System.Web.Administration.WebAdminPage.OpenWebConfiguration(String path, Boolean getWebConfigForSubDir) at System.Web.Administration.WebAdminPage.VerifyAppValid()&lt;/DIV&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;br /&gt;&lt;P&gt;Isn't that pretty!&lt;/P&gt;&lt;br /&gt;&lt;P&gt;It would seem that MS only wants this site to work with Cassini, i.e. the web server that comes with Visual Studio 2005. Well it is a great site, and it saves you so much work, so I wanted to include it in a project I am working on, so I set out this morning determined to figure out the problem and get it working, and I did.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;The web site itself lives in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\App_Code, and if you look inside the App_Code folder you will find the code behind class for the default.aspx page, it is called WebAdminPage.cs. If you have a look inside this class, at around line 328, you will find a function called OpenWebConfiguration:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;br /&gt;&lt;DIV&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Configuration OpenWebConfiguration(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; path, &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; appPhysPath, &lt;SPAN class=kwrd&gt;&lt;br /&gt;						bool&lt;/SPAN&gt; getWebConfigForSubDir) {&lt;br /&gt;            &lt;SPAN class=rem&gt;// check if session expired&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (String.IsNullOrEmpty(ApplicationPath) || &lt;br /&gt;		String.IsNullOrEmpty((&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)Session[APP_PHYSICAL_PATH])) {&lt;br /&gt;                Server.Transfer(&lt;SPAN class=str&gt;"~/home2.aspx"&lt;/SPAN&gt;);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (String.IsNullOrEmpty(path)) {&lt;br /&gt;                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; WebConfigurationManager.OpenWebConfiguration(&lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; appVPath = (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)Session[APP_PATH];&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (!getWebConfigForSubDir) {&lt;br /&gt;                appVPath = path;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            WebConfigurationFileMap fileMap = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; WebConfigurationFileMap();&lt;br /&gt;            fileMap.VirtualDirectories.Add(appVPath, &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; VirtualDirectoryMapping(appPhysPath, &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;));&lt;br /&gt;            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; WebConfigurationManager.OpenMappedWebConfiguration(fileMap, path);&lt;br /&gt;        }&lt;/PRE&gt;&lt;/DIV&gt;&lt;br /&gt;&lt;P&gt;The problem occurs in the WebConfigurationManager.OpenMappedWebConfiguration(fileMap, path); function. The WebConfigurationManager class lives inside the System.Web dll, inside the System.Web.Configuration namespace. The OpenMappedWebConfiguration function has three alternates, the first one we have already seen, the third one we are not internested in, and the second one will help us solve our problem.&lt;BR&gt;&lt;/P&gt;&lt;br /&gt;&lt;DIV&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; System.Configuration.Configuration OpenMappedWebConfiguration&lt;br /&gt;					(WebConfigurationFileMap fileMap, &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; path, &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; site)&lt;br /&gt;{&lt;br /&gt;      &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; WebConfigurationManager.OpenWebConfigurationImpl(WebLevel.Path, fileMap, path, site, &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;&lt;br /&gt;								null&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;, IntPtr.Zero);&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;br /&gt;&lt;P&gt;You can see the this version of the OpenMappedWebConfiguration function takes an extra parameter called &lt;EM&gt;site&lt;/EM&gt;, and this corrisponds to the name of the IIS website which the call came from. The solution to our problem is this...when this web site is being used by IIS we need to use the second version of the OpenWebConfigurationImpl and pass it the name of the current IIS website, if we are not using IIS then we just use the first version of OpenWebConfigurationImpl. &lt;/P&gt;&lt;br /&gt;&lt;P&gt;So why will this website work on the Default Web Site in IIS, without any modifications, I really don't know. I used &lt;A href="http://www.aisto.com/roeder/dotnet/"&gt;Reflector&lt;/A&gt; and found that the errors were coming from the three functions below, which can be found in the System.Configuration dll, in the System.Configuration namespace, in the Configuration class, the problem is around IsVirtualPathConfigPath returning false, I would guess, but unfortunatly, there is no real way to debug this.&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;override&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; InitForConfiguration(&lt;SPAN class=kwrd&gt;ref&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; locationSubPath, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; configPath, &lt;SPAN class=kwrd&gt;&lt;br /&gt;					out&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; locationConfigPath, &lt;br /&gt;					IInternalConfigRoot configRoot, &lt;SPAN class=kwrd&gt;&lt;br /&gt;					params&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt;[] hostInitConfigurationParams)&lt;br /&gt;{&lt;br /&gt;      WebLevel level1 = (WebLevel) hostInitConfigurationParams[0];&lt;br /&gt;      ConfigurationFileMap map1 = (ConfigurationFileMap) hostInitConfigurationParams[1];&lt;br /&gt;      VirtualPath path1 = VirtualPath.CreateAbsoluteAllowNull((&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;) hostInitConfigurationParams[2]);&lt;br /&gt;      &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; text1 = (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;) hostInitConfigurationParams[3];&lt;br /&gt;      &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (locationSubPath == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)&lt;br /&gt;      {&lt;br /&gt;            locationSubPath = (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;) hostInitConfigurationParams[4];&lt;br /&gt;      }&lt;br /&gt;      &lt;SPAN class=kwrd&gt;base&lt;/SPAN&gt;.Host.Init(configRoot, hostInitConfigurationParams);&lt;br /&gt;      &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.SetConfigRoot(configRoot);&lt;br /&gt;      &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ChooseAndInitConfigMapPath(&lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;, map1);&lt;br /&gt;      WebConfigurationHost.GetConfigPaths(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._configMapPath, level1, path1, text1, &lt;br /&gt;					locationSubPath, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._appPath, &lt;SPAN class=kwrd&gt;&lt;br /&gt;					out&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._appSiteName, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._appSiteID, &lt;SPAN class=kwrd&gt;&lt;br /&gt;					out&lt;/SPAN&gt; configPath, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; locationConfigPath);&lt;br /&gt;&lt;FONT style="BACKGROUND-COLOR: #9acd32" color=#000000&gt;      	&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._appConfigPath &lt;br /&gt;= WebConfigurationHost.GetConfigPathFromSiteIDAndVPath(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._appSiteID, &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._appPath);&lt;/FONT&gt;&lt;br /&gt;      &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (WebConfigurationHost.IsVirtualPathConfigPath(configPath))&lt;br /&gt;      {&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; text2;&lt;br /&gt;            VirtualPath path2;&lt;br /&gt;            WebConfigurationHost.GetSiteIDAndVPathFromConfigPath(configPath, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; text2, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; path2);&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; text3 = &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;._configMapPath.MapPath(text2, path2);&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;.IsNullOrEmpty(text3))&lt;br /&gt;            {&lt;br /&gt;                  &lt;SPAN class=kwrd&gt;throw&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ArgumentOutOfRangeException(&lt;SPAN class=str&gt;"site"&lt;/SPAN&gt;);&lt;br /&gt;            }&lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;internal&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; GetSiteIDAndVPathFromConfigPath(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; configPath, &lt;SPAN class=kwrd&gt;out&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; siteID, &lt;SPAN class=kwrd&gt;&lt;br /&gt;									out&lt;/SPAN&gt; VirtualPath vpath)&lt;br /&gt;{&lt;br /&gt;&lt;FONT style="BACKGROUND-COLOR: #9acd32"&gt;      &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (!WebConfigurationHost.IsVirtualPathConfigPath(configPath))&lt;/FONT&gt;&lt;br /&gt;      {&lt;br /&gt;            siteID = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;&lt;br /&gt;            vpath = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;&lt;br /&gt;      }&lt;br /&gt;      &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;br /&gt;      {&lt;br /&gt;            &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; num3;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; num1 = &lt;SPAN class=str&gt;"MACHINE/WEBROOT"&lt;/SPAN&gt;.Length + 1;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; num2 = configPath.IndexOf(&lt;SPAN class=str&gt;'/'&lt;/SPAN&gt;, num1);&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (num2 == -1)&lt;br /&gt;            {&lt;br /&gt;                  num3 = configPath.Length - num1;&lt;br /&gt;            }&lt;br /&gt;            &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;br /&gt;            {&lt;br /&gt;                  num3 = num2 - num1;&lt;br /&gt;            }&lt;br /&gt;            siteID = configPath.Substring(num1, num3);&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (num2 == -1)&lt;br /&gt;            {&lt;br /&gt;                  vpath = VirtualPath.RootVirtualPath;&lt;br /&gt;            }&lt;br /&gt;            &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;br /&gt;            {&lt;br /&gt;                  vpath = VirtualPath.CreateAbsolute(configPath.Substring(num2));&lt;br /&gt;            }&lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;internal&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt; IsVirtualPathConfigPath(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; configPath)&lt;br /&gt;{&lt;br /&gt;      &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; (configPath.Length &gt; &lt;SPAN class=str&gt;"MACHINE/WEBROOT"&lt;/SPAN&gt;.Length);&lt;br /&gt;}&lt;/PRE&gt;So, here is the solution to our problem: &lt;br /&gt;&lt;OL&gt;&lt;br /&gt;&lt;LI&gt;Backup the WebAdminPage.cs i.e. Copy and past the WebAdminPage.cs class and rename it to WebAdminPage.cs_old &lt;br /&gt;&lt;LI&gt;Add the following function somewhere into the WebAdminPage class: &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;        &lt;SPAN class=rem&gt;/// &lt;summary&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=rem&gt;/// Checks to see if the request has come in through an IIS web server &lt;br /&gt;	///(i.e. not Cassini), and&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=rem&gt;/// if so, gets the IIS website instance and returns it's name&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=rem&gt;/// &lt;/summary&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=rem&gt;/// &lt;param name="request"&gt;The incoming request&lt;/param&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=rem&gt;/// &lt;returns&gt;The name of the iis website through which the call has come in from. &lt;br /&gt;	///If this is anything other&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=rem&gt;/// than an IIS website and empty string will be returned.&lt;/returns&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; GetSiteName(HttpRequest request)&lt;br /&gt;        {&lt;br /&gt;            &lt;SPAN class=rem&gt;///the server variables key for iis instance id&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;const&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; instanceIdKey = &lt;SPAN class=str&gt;"INSTANCE_ID"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///the server variable key for the type of server the call came from&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;const&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; serverSoftwareKey = &lt;SPAN class=str&gt;"SERVER_SOFTWARE"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///the iis properties key for the name of the website in IIS&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;const&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; serverCommentKey = &lt;SPAN class=str&gt;"ServerComment"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///the name of the IIS server w/o version&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;const&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; iisServerName = &lt;SPAN class=str&gt;"Microsoft-IIS"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///the base path name of the website in iis w/o its instance id&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;const&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; iisPathBase = &lt;SPAN class=str&gt;"IIS://localhost/W3SVC/"&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///get the instance id of the iis website that the call came from&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; instanceId = request.ServerVariables[instanceIdKey];&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///get the type of web server that the call has come from&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; webServer = request.ServerVariables[serverSoftwareKey];&lt;br /&gt;            &lt;br /&gt;            &lt;SPAN class=rem&gt;///we only want to perform these operations if this is an IIS website&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (webServer.ToLower().IndexOf(iisServerName.ToLower()) &gt; -1)&lt;br /&gt;            {&lt;br /&gt;                &lt;SPAN class=rem&gt;///get the iis website&lt;/SPAN&gt;&lt;br /&gt;                System.DirectoryServices.DirectoryEntry webSiteDir = &lt;SPAN class=kwrd&gt;&lt;br /&gt;			new&lt;/SPAN&gt; System.DirectoryServices.DirectoryEntry(iisPathBase + instanceId);&lt;br /&gt;&lt;br /&gt;                &lt;SPAN class=rem&gt;///get the property which contains its name&lt;/SPAN&gt;&lt;br /&gt;                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)webSiteDir.Properties[serverCommentKey].Value;&lt;br /&gt;            }&lt;br /&gt;            &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;br /&gt;                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;.Empty;&lt;br /&gt;        }&lt;/PRE&gt;&lt;br /&gt;&lt;LI&gt;Alter the &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Configuration OpenWebConfiguration(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; path, &lt;SPAN class=kwrd&gt;&lt;br /&gt;						string&lt;/SPAN&gt; appPhysPath, &lt;SPAN class=kwrd&gt;&lt;br /&gt;						bool&lt;/SPAN&gt; getWebConfigForSubDir)&lt;/PRE&gt;function to look like this: &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Configuration OpenWebConfiguration(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; path, &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; appPhysPath, &lt;SPAN class=kwrd&gt;&lt;br /&gt;							bool&lt;/SPAN&gt; getWebConfigForSubDir) {&lt;br /&gt;            &lt;SPAN class=rem&gt;// check if session expired&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (String.IsNullOrEmpty(ApplicationPath) || &lt;br /&gt;			String.IsNullOrEmpty((&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)Session[APP_PHYSICAL_PATH])) {&lt;br /&gt;                Server.Transfer(&lt;SPAN class=str&gt;"~/home2.aspx"&lt;/SPAN&gt;);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (String.IsNullOrEmpty(path)) {&lt;br /&gt;                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; WebConfigurationManager.OpenWebConfiguration(&lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; appVPath = (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)Session[APP_PATH];&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (!getWebConfigForSubDir) {&lt;br /&gt;                appVPath = path;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            WebConfigurationFileMap fileMap = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; WebConfigurationFileMap();&lt;br /&gt;            fileMap.VirtualDirectories.Add(appVPath, &lt;SPAN class=kwrd&gt;&lt;br /&gt;					new&lt;/SPAN&gt; VirtualDirectoryMapping(appPhysPath, &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;));&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///get the name of the website, this will only have a value if we are using IIS&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; siteName = GetSiteName(Context.Request);&lt;br /&gt;&lt;br /&gt;            &lt;SPAN class=rem&gt;///if it is null or empty we are not using IIS, so we do not &lt;br /&gt;	    ///need to supply the site name&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt;(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;.IsNullOrEmpty(siteName))&lt;br /&gt;                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; WebConfigurationManager.OpenMappedWebConfiguration(fileMap, path);&lt;br /&gt;            &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;br /&gt;                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; WebConfigurationManager.OpenMappedWebConfiguration(fileMap, path, siteName);&lt;br /&gt;        }&lt;/PRE&gt;&lt;br /&gt;&lt;LI&gt;Finally add the following code the the web.config file in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles inside the System.Web tag &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;compilation&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;assemblies&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;                &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;add&lt;/SPAN&gt; &lt;SPAN class=attr&gt;assembly&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, &lt;br /&gt;                		PublicKeyToken=B03F5F7F11D50A3A"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;assemblies&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;compilation&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;br /&gt;&lt;P&gt;Now you can just create your website in IIS, create a virtual directory and point it to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles, here is how do do that: &lt;/P&gt;&lt;br /&gt;&lt;OL&gt;&lt;br /&gt;&lt;LI&gt;Create a website in IIS &lt;br /&gt;&lt;LI&gt;Make sure it is set to run using ASP.NET 2.0 &lt;br /&gt;&lt;LI&gt;Create a new virtual directory called ASP.NETWebAdminFiles and point it to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles. &lt;br /&gt;&lt;LI&gt;Right click on the Virtual Directory and select Properties &lt;br /&gt;&lt;LI&gt;Click on the Virtual Directory tab and click the Create button beside Application Name. &lt;br /&gt;&lt;LI&gt;Change Execute Permissions to Scripts Only. &lt;br /&gt;&lt;LI&gt;Click on the Directory Security tab, click on Edit button for, Authentication and access control. &lt;br /&gt;&lt;LI&gt;Unclick Enable anonymous access and make sure Integrated Windows Authentication is the only check box clicked under Authenticated Access &lt;br /&gt;&lt;LI&gt;You can now go to the site using the following url as a template &lt;A href="http://localhost:8081/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Documents%20and%20Settings\Administrator\My%20Documents\Visual%20Studio%202005\WebSites\WebSite1\&amp;applicationUrl=/WebSite1"&gt;http://localhost:8081/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Documents%20and%20Settings\Administrator\My%20Documents\Visual%20Studio%202005\WebSites\WebSite1\&amp;applicationUrl=/WebSite1&lt;/A&gt; &lt;br /&gt;&lt;LI&gt;You may have to set read/write permissions on the Web.config of the web site that are trying to control the security for, as the ASP.NET admin site will try to edit it.&lt;/LI&gt;&lt;/OL&gt;&lt;br /&gt;&lt;P&gt;I hope this helps out a few people, please let me know if I need to make some corrections on this.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-5452301833236801049?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/5452301833236801049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=5452301833236801049' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/5452301833236801049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/5452301833236801049'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/10/using-aspnet-web-site-administration.html' title='Using the ASP.NET Web Site Administration Tool with IIS'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-34498132311070519</id><published>2006-07-24T22:08:00.000-07:00</published><updated>2007-06-28T17:13:25.243-07:00</updated><title type='text'>Debugging Javascript</title><content type='html'>You can do some pretty cool stuff with JavaScript, but with these pretty cool things comes something that can be a real pain to debug. JavaScript debugging in VS has come a long way and I think it is really impressive, but what if you are building a webpart for SharePoint which has JavaScript files deployed in the Layouts folder, what then smart guy?! Well last week under this very same senario I discovered the debugger; statement for JavaScript. Just place this statement anywhere is your Javascript, make sure to enable JavaScript debugging in your browser and then hit the page that uses your code. Once your browser hits this line you will be prompted to select a debugging tool and,  if you selected VS2005, your JavaScript file will be opened up and you will have a break point waiting patiently for you to figure out why you cannot divide 10 by 0 (see sample below).&lt;BR&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;script&lt;/SPAN&gt; &lt;SPAN class=attr&gt;type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="text/javascript"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; doStuff(myparam)&lt;BR&gt;{&lt;BR&gt;   debugger;&lt;BR&gt;   &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; i = &lt;SPAN class=str&gt;""&lt;/SPAN&gt;;&lt;BR&gt;   i = 10 / 0;&lt;BR&gt;}&lt;BR&gt;&lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;script&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-34498132311070519?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/34498132311070519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=34498132311070519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/34498132311070519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/34498132311070519'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/07/debugging-javascript.html' title='Debugging Javascript'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-5001699677583533767</id><published>2006-06-30T07:28:00.000-07:00</published><updated>2007-06-28T17:13:25.656-07:00</updated><title type='text'>Sometimes you need to just sit back and think for a second</title><content type='html'>&lt;P&gt;As developers we all know that sometimes you need to just sit back and look at the problem from a hot air balloon. I don't know how many times I have spent hours working trying to fix a problem that was caused by a misspelled word in an xml file (circa. yesterday). Here is a classic moment where it really would have been benifical to think about the action before actually carrying it out, I don't know how many times this exact senario has happened to me!&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BIG&gt;&lt;BIG&gt;&lt;BIG&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#000000 size=3&gt;From Seinfeld - The Cheever Letters&lt;/FONT&gt; &lt;/BIG&gt;&lt;/BIG&gt;&lt;/BIG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: So we go back to my apartment..&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: (Expressing shock) Woah. Whoa! Woah!&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: So, we're, uh, foolin' around there.. you know, it's getting a little passionate.. (Scoots closer to George, to prevent others from hearing) and, uh, she starts with the dirty talking.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: (Putting his hands up) Alright, alright, hold on! (Jerry has George's full attention) Time out! Woah, woah! (Scooting in, giddy) What did she say?&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: (Modest) Oh, you know, the usual..&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: No, I don't know. How do I know the usual?&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: Typical things.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: (Picking up the ketchup) What typical? Gimme typical. Gimme some typical.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: She says, uh.. (Mumbles something inaudible. George, so shocked by what he's just heard, accidentally squeezes the ketchup bottle - ketchup squirts out and files off-screen. George reacts deeply)&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: (Breathing deeply) That's very dirty. (Jerry nods) That's absolutely filthy.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: ..And then she starts talking about her panties.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: (Yelling out to a waitress) Gonna need some water here!&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: So I said something.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: Ok, what did you say?&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: (Defensively) Now, bear in mind, I am just trying to keep up.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: Of course.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: Okay? So, she's taking about her panties, so, uh.. So, I said, "You mean the panties your mother laid out for you?"&lt;/P&gt;&lt;br /&gt;&lt;P&gt;GEORGE: (Takes a few seconds to mull this one over. Shooting Jerry a confused look, he repeats it) "The panties your mother laid out for you"? (Jerry nods) What&lt;/P&gt;&lt;br /&gt;&lt;P&gt;does that mean?&lt;/P&gt;&lt;br /&gt;&lt;P&gt;JERRY: (Throwing up his hands) I don't know! It just popped out.&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-5001699677583533767?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/5001699677583533767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=5001699677583533767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/5001699677583533767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/5001699677583533767'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/06/sometimes-you-need-to-just-sit-back-and.html' title='Sometimes you need to just sit back and think for a second'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-1573179472352321514</id><published>2006-06-29T08:56:00.000-07:00</published><updated>2007-06-28T17:13:25.994-07:00</updated><title type='text'>Formating code for the web</title><content type='html'>&lt;P&gt;I am putting this here mainly because I can never find the link. This is a great website which will apply css styles to your code so that it will look all Visual Studio like when you post it on your blog or whereever you like to post things, it really is none of my business what you do in your spare time.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;A href="http://www.manoli.net/csharpformat/"&gt;http://www.manoli.net/csharpformat/&lt;/A&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-1573179472352321514?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/1573179472352321514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=1573179472352321514' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/1573179472352321514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/1573179472352321514'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/06/formating-code-for-web.html' title='Formating code for the web'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-2053394260516579504</id><published>2006-06-28T20:35:00.000-07:00</published><updated>2007-06-28T17:13:26.598-07:00</updated><title type='text'>Holy Hex Batman</title><content type='html'>&lt;P&gt;What kind of person chooses to work with a piece of technology which is not finished and has limited and not uptodate documentation, me for one, and a couple of million others who probably need their heads examined. Yeah, working with beta technology, I love it, I get a sick pleasure out of putting my arm into this black hole and seeing what it will pull out. Well while working with MOSS 2007 over the last couple of days I pulled out a doosey.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Features are and content types are a great addition to SharePoint v3, but lets say you want to create a content type as a feature with little or no documentation about about parts of the schema, that my friends is a feature all onto itself. Below are some of the content types that are included in the PublishingResources feature which comes out of the box, this what I used for my guide.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0x0101000F1C8B9E0EB4BE489F09807B2C53288F"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$Resources:cmscore,contenttype_systemmasterpage_name;"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$Resources:cmscore,contenttype_systemmasterpage_description;"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_Hidden"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Sealed&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="TRUE"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRef&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="{9da97a8a-1da5-4a77-98d3-4bc10456e700}"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Comments"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;DisplayName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$Resources:core,Description;"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRef&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="{aea1a4dd-0f19-417d-8721-95a1d28762ab}"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="PublishingContact"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRef&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="{188ce56c-61e0-4d2a-9d3e-7561390668f7}"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="PublishingPreviewImage"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;            &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRef&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="{7581e709-5d87-42e7-9fe6-698ef5e86dd3}"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="PublishingHidden"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0x0101000F1C8B9E0EB4BE489F09807B2C53288F0054AD6EF48B9F7B45A142F8173F171BD1"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$Resources:cmscore,contenttype_masterpage_name;"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$Resources:cmscore,contenttype_masterpage_description;"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$Resources:cmscore,group_publishingcontenttypes;"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Sealed&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="FALSE"&lt;/SPAN&gt; &lt;br /&gt;                    &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;DocumentTemplate&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TargetName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="PublishingMasterTemplate.master"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;There is documentation for most of this except for the id attribute (this is true at the time of writing) which just looks like a big dirty hex value, oh, and there is one other thing, How am I supposed to generate this?, small issue, no biggie.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;So I managed to figure it out the good old fashioned way, hacking at it like someone had just told me that if I didn't figure it out I would have to write COBOL for the rest of my life, that is not event funny. I started by writing a few lines of C# which converted a GUID into it's equivalent hex value, that was way off. Then I noticed that all of the ids for the content types in this feature started with 0x010100 and the characters following , on the first sample above, looked like a GUID without brackets or hyphens, turns out I was right. So I created an id using this methodology and it set me up as a inheriting from the Document content type but what I wanted to do was inherit from the Page content type.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;I remembered from working with the discussion groups in SharePoint v2, on the database level, that the id for post replies was made up of the original post id followed by a new id for that post, and then a reply to that post would be made up of those two post ids contcatenated followed by a new id for that post, you can see that pattern by now I think. It appeared as if that was what was going on here, it was, but with one slight change, the ids must be seperated by '00', easy right!!&lt;/P&gt;&lt;br /&gt;&lt;P&gt;From my experiments here is what I have found:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;All ids must inherit (begin with)  one of the types in this file &lt;FONT face="Courier New" color=#000000&gt;ctypeswss.xml &lt;FONT face="Times New Roman"&gt;which belongs to this feature  &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\ctypes &lt;/FONT&gt;&lt;FONT face="Times New Roman"&gt;Here are two of the more common types:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;LI&gt;&lt;FONT face="Courier New"&gt;0x01&lt;/FONT&gt; - An Item Content Type &lt;br /&gt;&lt;LI&gt;&lt;FONT face="Courier New" color=#000000&gt;0x0101&lt;/FONT&gt; - A Document Content Type&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P&gt;All inheriting ids must be seperated by &lt;FONT face="Courier New"&gt;00&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;So if you wanted your own custom document content type it's id would be &lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt; &lt;FONT face="Courier New"&gt;0x0101&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#006400&gt;00&lt;/FONT&gt;&lt;FONT color=#ff1493&gt;BA8858B9015344bd9A6B30F1512A2623 &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;FONT color=#000000&gt;where &lt;/FONT&gt;&lt;FONT color=#ff1493&gt;&lt;FONT face="Courier New"&gt;BA8858B9015344bd9A6B30F1512A2623&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT color=#000000&gt;is my own unique guid. And if I wanted a to create a content type that would inherit from this id it would have to be &lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#000000&gt;&lt;FONT color=#0000ff&gt;0x0101&lt;/FONT&gt;&lt;FONT color=#006400&gt;00&lt;/FONT&gt;&lt;FONT color=#ff1493&gt;BA8858B9015344bd9A6B30F1512A2623&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#006400&gt;00&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;BC82C01887E347749E1FA371534CB19B &lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;FONT color=#000000&gt;where &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT face="Courier New"&gt;BC82C01887E347749E1FA371534CB19B&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT color=#000000&gt;is my own unique GUID&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;There could be some other rules around all of this but I have not found any as of yet. Below are some sample content types that inherit from some existing content types:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Elements&lt;/SPAN&gt; &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/sharepoint/"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;br /&gt;    &lt;SPAN class=rem&gt;&lt;!-- Custom This Does Not Work --&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="YourGuidWithOutBracketsOrHyphens"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeA"&lt;/SPAN&gt;&lt;br /&gt;                 &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeA"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialContentTypes"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;br /&gt;    &lt;SPAN class=rem&gt;&lt;!-- Document --&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0x010100YourGuidWithOutBracketsOrHyphens"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeB"&lt;/SPAN&gt;&lt;br /&gt;                 &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeB"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialContentTypes"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt;SPAN class=rem&gt;&lt;!-- System Page--&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0x010100C568DB52D9D0A14D9B2FDCC96666E9F200YourGuidWithOutBracketsOrHyphens"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeC"&lt;/SPAN&gt;&lt;br /&gt;                 &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeC"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialContentTypes"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;        &lt;br /&gt;&lt;br /&gt;    &lt;SPAN class=rem&gt;&lt;!-- Page --&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900YourGuidWithOutBracketsOrHyphens"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeD"&lt;/SPAN&gt;&lt;br /&gt;                 &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeD"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialContentTypes"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt;SPAN class=rem&gt;&lt;!-- Item --&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0x0100YourGuidWithOutBracketsOrHyphens"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeE"&lt;/SPAN&gt;&lt;br /&gt;                 &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SpecialTypeE"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialContentTypes"&lt;/SPAN&gt; &lt;br /&gt;                 &lt;SPAN class=attr&gt;Version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;FieldRefs&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ContentType&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;        &lt;br /&gt;    &lt;br /&gt;&lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Elements&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-2053394260516579504?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/2053394260516579504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=2053394260516579504' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2053394260516579504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2053394260516579504'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/06/holy-hex-batman.html' title='Holy Hex Batman'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-2569214576586193217</id><published>2006-06-15T07:10:00.000-07:00</published><updated>2007-06-28T17:13:27.282-07:00</updated><title type='text'>That's so far away, I can't click over there!!</title><content type='html'>&lt;P&gt;So I am sure you have got one of these requests, "I want to be able to open my Outlook from a link on the website.". It is an undstandable request, as most people are unaware of some of the features that windows has, such as, putting a shortcut on your desktop, or putting that very same shortcut into your quick launch toolbar, or even this crazy one, set it up so that when you minimise it it will go and live beside your clock in the system tray. By the way, here is a great app called &lt;A href="http://en.softonic.com/ie/32372/TrayIt!"&gt;TrayIt!&lt;/A&gt; that allows you to minimise anything to the system tray.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Anyway, enough of my venting, here is some simple javascript to help you achieve that task. You could just create a new ActiveX object everytime and then call &lt;FONT face="Courier New" size=2&gt;mailfolder.display();&lt;/FONT&gt;, but if you do that it will create a brand new window every time you click on the link, not a new instance, just a whole wack load of new windows. The code in the &lt;FONT face="Courier New" size=2&gt;if&lt;/FONT&gt; statement will open outlook and display it if is either closed or minimised to the system tray. If it is minimised on the taskbar or sitting out of focus behind the browser then the code in the &lt;FONT face="Courier New" size=2&gt;else&lt;/FONT&gt; statement will come into play. The reason the &lt;FONT face="Courier New" size=2&gt;timeout&lt;/FONT&gt; is there is because if the code is minimised on the taskbar or out of focus there does not seem to be away to bring it back into focus, so I just minimise it to the system tray and then bring it back to life after a period of time.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;If the Outlook link looks like this &lt;FONT face="Courier New" size=2&gt;BLOCKED SCRIPTopenOutlook&lt;/FONT&gt;, replace &lt;FONT face="Courier New" size=2&gt;BLOCKED SCRIPT&lt;/FONT&gt; with &lt;FONT face="Courier New" size=2&gt;j a v a s c r i p t:&lt;/FONT&gt; (make sure to remove the spaces from this. If I didn't put the spaces in it would say &lt;FONT face="Courier New" size=2&gt;BLOCKED SCRIPT&lt;/FONT&gt; again.). It would appear that my blogging app has a filter that is trying to protect you all. And you thought no one cared about you.&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;a&lt;/SPAN&gt; &lt;SPAN class=attr&gt;href&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="javascript:openOutlook();"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;Open Outlook&lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;a&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;script&lt;/SPAN&gt; &lt;SPAN class=attr&gt;type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="text/javascript"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt; &lt;br /&gt;    &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objOutlook = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; openOutlook(){&lt;br /&gt;        objOutlook = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ActiveXObject(&lt;SPAN class=str&gt;"Outlook.Application"&lt;/SPAN&gt;) &lt;br /&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt;(objOutlook.ActiveWindow == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)&lt;br /&gt;        {&lt;br /&gt;            &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;&lt;br /&gt;            {    &lt;br /&gt;                &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;namespace&lt;/SPAN&gt; = objOutlook.getNameSpace(&lt;SPAN class=str&gt;"MAPI"&lt;/SPAN&gt;); &lt;br /&gt;                &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; mailfolder = &lt;SPAN class=kwrd&gt;namespace&lt;/SPAN&gt;.getDefaultFolder(6) ;&lt;br /&gt;                mailfolder.display();&lt;br /&gt;            }&lt;br /&gt;            &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt;(e)&lt;br /&gt;            {}&lt;br /&gt;        }    &lt;br /&gt;        &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;br /&gt;        {&lt;br /&gt;            objOutlook.ActiveWindow.WindowState = 1;&lt;br /&gt;            window.setTimeout(&lt;SPAN class=str&gt;'openOutlook();'&lt;/SPAN&gt;, 50);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;script&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-2569214576586193217?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/2569214576586193217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=2569214576586193217' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2569214576586193217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/2569214576586193217'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/06/that-so-far-away-i-can-click-over-there.html' title='That&amp;#39;s so far away, I can&amp;#39;t click over there!!'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-3710893141781723389</id><published>2006-06-12T20:45:00.000-07:00</published><updated>2007-06-28T17:13:27.730-07:00</updated><title type='text'>Ronaldinho</title><content type='html'>&lt;P&gt;So what if he can do that, I bet he doesn't have a clue about Iron Python. Check out the video below.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;A href="http://www.ifilm.com/ifilmdetail/2710076"&gt;http://www.ifilm.com/ifilmdetail/2710076&lt;/A&gt; &lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-3710893141781723389?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/3710893141781723389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=3710893141781723389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/3710893141781723389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/3710893141781723389'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/06/ronaldinho.html' title='Ronaldinho'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6324323728367352122.post-4604258839500129292</id><published>2006-06-12T09:50:00.000-07:00</published><updated>2007-06-28T17:13:28.174-07:00</updated><title type='text'>Custom Columns in MOSS 2007</title><content type='html'>&lt;P&gt;If you are trying to create a custom column as a feature in MOSS 2007 then the documentation is a bit off, so if you are having problems they may not be your fault. Here is a sample that works for sure. Create a folder under the directory below called &lt;CODE&gt;MyDescriptionField.&lt;/CODE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;CODE&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES&lt;/CODE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;When SharePoint is trying to install a new feature it will look in the folder you have created for a file called Feature.xml, this serves as a description of the feature that you are installing, aswell as pointing to any additional files that make up the feature. So create two files in the folder called Feature.xml and Elements.xml . See the content for each one below. The GUIDs that are used for ids on each file are unique to me, so you should create your own.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;FONT size=4&gt;&lt;STRONG&gt;Feature.xml&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="utf-8"&lt;/SPAN&gt; ?&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Feature&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="{957328F8-AC46-4c91-9971-584BA3649A05}"&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=attr&gt;Title&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialField"&lt;/SPAN&gt; &lt;br /&gt;    &lt;SPAN class=attr&gt;Description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="A Field Which is used for stuff."&lt;/SPAN&gt; &lt;br /&gt;    &lt;SPAN class=attr&gt;Scope&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Site"&lt;/SPAN&gt; &lt;br /&gt;&lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/sharepoint/"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ElementManifests&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;        &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ElementManifest&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Location&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Elements.xml"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;    &lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ElementManifests&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Feature&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;FONT size=4&gt;&lt;STRONG&gt;Elements.xml&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Elements&lt;/SPAN&gt; &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/sharepoint/"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt; &lt;br /&gt;  &lt;SPAN class=kwrd&gt;&lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Field&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ID&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="{D0CEF044-7CA8-46d1-85B1-9C8711E691BA}"&lt;/SPAN&gt;&lt;br /&gt;   &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialFieldName"&lt;/SPAN&gt;&lt;br /&gt;   &lt;SPAN class=attr&gt;RowOrdinal&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt;&lt;br /&gt;   &lt;SPAN class=attr&gt;Group&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialGroup"&lt;/SPAN&gt;&lt;br /&gt;   &lt;SPAN class=attr&gt;DisplayName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MySpecialFieldDisplayName"&lt;/SPAN&gt;&lt;br /&gt;   &lt;SPAN class=attr&gt;Type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Text"&lt;/SPAN&gt;&lt;br /&gt;   &lt;SPAN class=attr&gt;Required&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="TRUE"&lt;/SPAN&gt;&lt;br /&gt;  &lt;SPAN class=kwrd&gt;/&gt;&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN class=kwrd&gt;&lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Elements&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Finally you can install and activate the feature by using the stsadm tool on the command line, here are the command you will need:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;CODE&gt;stsadm -o deactivatefeature -id 957328F8-AC46-4c91-9971-584BA3649A05 -url http://mymachinename:25898&lt;BR&gt;stsadm -o uninstallfeature -id 957328F8-AC46-4c91-9971-584BA3649A05 -force&lt;BR&gt;stsadm -o installfeature -filename MyDescriptionField\Feature.xml&lt;BR&gt;stsadm -o activatefeature -filename MyDescriptionField\Feature.xml -url http://mymachinename:25898&lt;/CODE&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6324323728367352122-4604258839500129292?l=www.converttostring.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.converttostring.com/feeds/4604258839500129292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6324323728367352122&amp;postID=4604258839500129292' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4604258839500129292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6324323728367352122/posts/default/4604258839500129292'/><link rel='alternate' type='text/html' href='http://www.converttostring.com/2006/06/custom-columns-in-moss-2007.html' title='Custom Columns in MOSS 2007'/><author><name>Ciaran McAuliffe</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
