30 July 2009

Get Byte Array using Enterprise Library

It took me a while to figure this out so I thought I would post the solution here. I needed to get a blob out of the database and assign it to a byte[] in my object

Solution

//initialise the byte[] and get its size
byte[]
byteArray = new byte[(dr.GetBytes(dr.GetOrdinal("File"), 0, null, 0, int.MaxValue))];
//Assign bytes to byte array
dr.GetBytes(dr.GetOrdinal("File"), 0, byteArray, 0, byteArray.Length);
//Assign Value
file.FileByte = byteArray;

Enjoy

25 July 2009

SharePoint 2007 & .Net 3.5 SP1

Problem

“The Registry Records Center could not be found or accessed”

Last week I was working on a few problems we were having with SharePoint and Office 2007. One of those problems happened all of a sudden and the Send to Records Centre stopped working. The error we were getting was The Registry Records Center could not be found or accessed. Registry being the name of our Records Centre.

I was told that an emergency service pack needed to be installed for .Net Framework 2.0 to resolve some of our issues but nothing was mentioned about .Net 3.5 and SP1

It turns out that after installing .Net 3.5 all seems to be well in the SharePoint space, but installing 3.5 SP1 breaks the Send to Records functionality.
I can across this blog entry by Aghy: http://dotneteers.net/blogs/aghy/archive/2008/10/31/moss-2007-and-net-framework-3-5-sp1.aspx

Solution

I created a .reg file described in the kb and all my problems went away, well at least this one. You can download the file here

It seems that it is the loopback check that .NET 3.5 SP1 introduces that is causing a problem. The solution is described in the MS kb 896861

KB description
You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or IIS 6 http://support.microsoft.com/kb/896861

The file contents are:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"DisableLoopbackCheck"=dword:00000001

Silent

I have been silent for a while. I have been completing my MSc in computer science at Birkbeck which I found out I passed, what a huge relief.

I still have a SaaS project using WCF and Silverlight that I working on to hand in to seal the deal. It is coming along nicely and I will post parts of the project here and some cool things I have learned. The new part of the framework, WCF, that I have not used before is super cool & powerful