Sunday, July 01, 2007

MOSS 2007 Enterprise Search: Metadata Property Mappings

When adding a new Managed Property under Search Settings in a Shared Service Provider (SSP), you may encounter the ambiguous error:

The settings could not be saved because of an internal error: name

This could occur if you have spaces or underscores in the name. Remove all spaces and you should be good to go!

Friday, October 27, 2006

SQL Server: Search for a Column Name in a Database

SELECT TABLE_NAME,COLUMN_NAME
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
COLUMN_NAME LIKE '%column%'
ORDER BY TABLE_NAME

Windows 2003 Server - IIS 6.0: Service Unavailable When Using Custom Account for Identity

When you try to use a custom account to have the application pool in IIS 6.0 run its identity, it's very likely that you'll end up with the following error: Service Unavailable.

This error is not descriptive enough as the reasons could be plenty. If you go to the application pool, you'll find that it has been disabled. The event log gives that clue with this error:

A failure was encountered while launching the process serving application pool 'Name of Applicaiton Pool'. The application pool has been disabled.

In order to solve this problem, you need to go Administritive Tools --> Local Security Policy. Go to Security Settings --> Local Policies --> User Rights Management, look for 'Logon as a service', click on Properties, and add the user account you are trying to use as a service account.

I've read that you have to restart the server after making these changes. I've also been told that adding that account to the IIS_WPG group would automatically give that right to the user account. I haven't tested the latter option (it's possible that restarting the service automatically adds the user to IIS_WPG).

Tuesday, May 02, 2006

ASP.NET: TextBox losing data on postback

Some may have encountered a problem where a TextBox may lose its data upon posting back although EnableViewState is set to true. Assuming the TextBox is not a password field (does not get saved for obvious reasons), there is one other reason that you don't see documented anywhere: if you carelessly copied your WebForm and forgot to update the codebehind path or the namespace!

Tuesday, November 22, 2005

SQL Server 2000: change database name

To change the database name, make sure you close Enterprise Manager. Using SQL Query Analyzer, run the following command:

alter database EXISTING_DATABASE_NAME modify name = NEW_DATABASE_NAME

Wednesday, November 02, 2005

A Comparison of Web Development Technologies: ASP.NET vs. WebObjects

My Masters Project, A Comparison of Web Development Technologies: ASP.NET vs. WebObjects, can be accessed here. I defended the project November 2, 2005. Feel free to visit my WebObjects blog.

Friday, June 24, 2005

SharePoint 2003: How to exclude paths to run ASP.NET applications

Running an ASP.NET application on a server with a SharePoint instance requires excluding the virtual paths the application needs, as the SharePoint ISAPI filter will intercept all requests. This post assumes you have SharePoint installed as a Default Web Site.

1. From the Administration Tools, click on SharePoint Central Administration.

2. Click on SharePoint Portal Server in the left menu.

3. Click on Configure virtual server settings from the Virtual Server List page.

4. Click on Default Web Site.

5. Click on Define managed paths.

6. Enter a path, check Exclude Path, and click OK.

Monday, June 20, 2005

SharePoint 2003: How to import a Web Part and mark it safe (without adding the assembly to the GAC)

You may have encountered the following error when trying to add a Web part to a page:

A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe.

There are two possible causes: either the Web part has not been strongly named/hasn't been added as such in the Web.config, or the Web part's DLL or one of its referenced DLLs were not placed in the bin directory.

Below are steps to make a Web part safe:

1. The assembly has to have a strong name. You need the strong name tool sn.exe. From the command line:

cd \Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin

sn.exe -k “YourProjectPath\ProjectNameKeyPair.snk”


2. In the AssemblyInfo.cs file, find

[assembly: AssemblyVersion("1.0.*")]

and change it to [assembly: AssemblyVersion("1.0.0.0")]

scroll to the end and replace the entry that reads

[assembly: AssemblyKeyFile("")]

with

[assembly: AssemblyKeyFile("..\\..\\ProjectNameKeyPair.snk")]

3. Compile your project. Now you need to get the public key token. To do so, run the sn.exe utility again:

sn.exe –T “YourProjectPath\obj\[Release or Debug]\AssemblyName.dll

4. In the .dwp file, replace the AssemblyName entry with:

AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=PublicKey

5. In the web.config file, you need to mark the Web Part as safe by adding the following under the SafeControls section:

<SafeControl Assembly="Copy_the_entry_from_the_dwp_file" Namespace=" Copy_the_entry_from_the_dwp_file" TypeName="*" Safe="True"/>

Remember that you need to repeat the above for every DLL referenced by the WebPart (directly or indirectly)

6. Copy the Web Part’s DLL (and dependencies) to the bin directory under the SharePoint directory. If there isn’t one, create it.

7. Add the .dwp file using the import function.

Resources:

1. Create a basic WebPart
2. MSDN SharePoint: making a WebPart safe
3. SharePoint Products and Technologies Resource Kit

Sunday, June 19, 2005

About me

I am a software developer focusing mainly on the .NET framework and the powerful WebObjects system from Apple. I have about two and half years of experience in .NET, and half of that in WebObjects. My comparative study between ASP.NET and WebObjects is due, God willing, to be released in September. Until then, feel free to visit my WoNet blog, where .NET and WebObjects meet.

This blog will cover a variety of issues and challenges that I face and solve in my daily work.