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!

6.7.06

View Trace.axd v1.2!

Its finally been approved!
Get it here
This version is smarter than before and will now open Trace.axd only when one exists and if the current page is Trace.axd it does nothing.

2.7.06

SQL Code Camp

This is the first I heard about SQL Code Camp - http://www.sqldownunder.com/CodeCamp/tabid/53/Default.aspx
Perhaps I'm just not reading the right blogs?
I'll have to mention it at work to see if we can go...

29.6.06

... and one more JavaScript thig

I also forgot to mention JavaScript Lint - http://www.javascriptlint.com/

You can add it in as an external tool in Visual Studio and get a JavaScript code checker, like FXCop woohoo!

Javascript and screen readers

I found two great posts today focusing on JavaScript with screen readers.

The first one is a test to try and get a screen reader to read changes in the DOM the conclusion is that it doesnt work L

http://www.sitepoint.com/article/ajax-screenreaders-work

This second post is even more interesting as it shows which JavaScript events are compatible with which screen reader all in one table

http://www.access-matters.com/results-for-javascript-part-2-navigating-forms/

TechEd Flair


Here is my first attempt at some flair for this year

11.6.06

View Trace.axd

My view trace.axd Firefox extention became live today - woo!

24.5.06

Stylus Studio

I use Stylus Studio at work and have found it to be a great XML tool.
When developing our XML driven flash application at work, stylus studio made creating the schema's and xml easy.
I've also used it serveral times to get my Xpath queries right, which is also great.

3.11.05

Open Source CMS

This site has a collection of opensource CMS's that are avaliable to play with without installing them fist only to find out that its rubbish.