14.11.07

Sharepoint / MOSS url rewriting

For the current project I'm working on I needed to get rid of MOSS' /Pages - the client wants nicer looking URL's.
I came across this project which is really simple to use: UrlRewriter

Installing it in SharePoint is also really simple, especially since UrlRewiter is already signed. Just simply GAC the assembly, and add the following to the web.config:

<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter, Version=2.0.0.6, Culture=neutral, PublicKeyToken=0573f3650687980d" />
</configSections>
<SharePoint>
<SafeControls>
<SafeControl Assembly="Intelligencia.UrlRewriter, Version=2.0.0.6, Culture=neutral, PublicKeyToken=0573f3650687980d" Namespace="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler" TypeName="*" Safe="True">
</SafeControls>
</SharePoint>
<system.web>
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter, Version=2.0.0.6, Culture=neutral, PublicKeyToken=0573f3650687980d" name="UrlRewriter" />
</httpModules>
</system.web>


Finally add this in the configuration section:

<rewriter>
<if url="^((?!/Pages/|/Style%20Library/|/Style Library/|/_layouts/|/).+)*$">
<rewrite to="/Pages/$1" />
</if>
</rewriter>


UrlRewriter uses a regular expressions in order to match and replace the url:
^((?!/Pages/|/Style%20Library/|/Style Library/|/_layouts/|/).+)*$

So this will find all url's that don't start with /Pages/ and add it on.

18.9.07

MCTS!

After a long wait I have finally got my MCP ID!






The plan is to get all the developer and sharepoint certs...

1.8.07

Sharepoint: The object specified does not belong to a list

I had a problem this morning, with a custom control that I am using in PublishingPages and admin pages in the _layouts folder.
The control looks for some custom properties in the current pages ParentFolder. However when checking the SPFile.ParentFolder.Item property in a page located in _layouts it throws an exception - "The object specified does not belong to a list".
My first thought was to check for SPFile.ParentFolder.Item != null, but that didn't work. However by setting a break point I discoverd that folders in the _layouts directory don't exist!

So use: if(SPFolder.Exists) {}

31.7.07

WSS coding best practice

This article is a must read: http://msdn2.microsoft.com/en-us/library/ms778813.aspx

I've been having a few memory problems lately in the project im currently working on. I thought I was correctly disposing of all my SPWeb and SPSite objects but I didn't realise that even accessing SPFolder.ParentWeb would create a new instance if one wasn't available.

23.6.07

Two useful WSS v3 resources

Just a quick post.
I found these two resources useful today.
The first is a step by step guide to installing and configuring MOSS in Virtual PC. The steps are very clear and surprisingly everything went according to the guide - no small feat!
http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?List=7537e639%2Db4e5%2D48b6%2D97c0%2Da75e44ee9be3&ID=28&Source=http%3A%2F%2Fwww%2Epptspaces%2Ecom%2Fsharepointreporterblog%2FLists%2FPosts%2FAllPosts%2Easpx

The second is a look at the process of developing with WSS. It has a really good look at packaging a project into a solution that can be deployed to a server.
http://msdn2.microsoft.com/en-us/library/bb530302.aspx#WSSDevToolsTechs_P1_CloserLookWinSharePointServicesSolutions

29.5.07

Oconics expands

We were in the paper today!
http://www.news.com.au/adelaidenow/story/0,22606,21810204-5003680,00.html

Very cool!

jQuery Manager for .Net

I released the early version of my jQuery Script Manager today on CodePlex.
Its an idea that I have had for the past couple of days in an attempt to make using jQuery and ASP.Net work nicely. I've been using JavaScript lately with SharePoint (WSS v3 & MOSS) and I've been unhappy with how injected JavaScript can get really messy. This project is an attempt to make it better.

What is jQuery you ask?

So here is how its currently used:

1) Add the jQuery Script Manager to the page

<%@ Register Assembly="jQuery.ScriptManager, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null
" Namespace="jQuery.ScriptManager" TagPrefix="jQuery" %>

...

<jQuery:jQueryManager id="jQueryM" runat="server">
</jQueryManager>


2) register any JavaScripts functions that need to run on document.load

<jQuery:jQueryManager id="jQueryM" runat="server">
<ReadyFunctions>
<jQuery:RegisterReadyFunction FunctionName="TestFunction" />
</ReadyFunctions>
</jQueryManager>


3) Create the JavaScript function

function TestFunction(){
alert('The page has loaded!');
}


The JavaScript function "TestFunction" will be called when the page loads by placing it in jQuery's $(document).ready function.

11.5.07

Embedding JavaScript as a resource in a .Net assembly

I needed to do this today for a web part that I'm creating. Being able to have the JavaScript packaged is so much neater.
http://aspnet.4guysfromrolla.com/articles/080906-1.aspx

10.5.07

ASP.Net AJAX and MOSS 2007

This post from Mike Ammerlaan just saved me some time on what to add to the Web.config for MOSS.

MOSS 2007 WebPart CAS

This is a good article on MOSS CAS - saved me some time!

Update:
I also discovered the hard way that if you use the sample config file associated with the article bad security things will happen. This is because WSS does not have permission to access the file, so I copied the wss_minimaltrust.config, and then copied the contents of the sample file into it.

18.4.07

Time to leave

I've decided that after 3 good years at UniSA that its time to leave.

I've had a great time there and have learnt a lot, but I really felt that it was time to move on.
I'm looking forward to the new challenge and hopefully I'll be more motivated to update this blog as I'll have new things to say!