Tuesday, March 10, 2009

How to create custom 404 error pages for MOSS applications?


Based on my scenario. I had couple different applications and I was needed to specify different custom 404 error pages under each one. In order to implement it you need to follow steps below.

1. By default you can find error page under location below:

%systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\LangID - sps404.html

2. Make two copies of this page and paste under the same location.

3. I assumed that you have by this time two custom pages you. In IIS under each application create Virtual Directory. For example "Custom Errors" and paste your custom build error pages in each application.

4. Than go to step 2 and make changes in each page (copied from sps404.html)

Change the name of the page:

STSNavigate("/_layouts/spsredirect.aspx?oldUrl=" + requestedUrl);

To:

STSNavigate("/_layouts/NameofYourCustomErrorPage.aspx?oldUrl=" + requestedUrl);

Save it (Do the same for both pages)

5. Time to use CodePlex application (you can download SharePoint Manager 2007 here).

Run it. Select Application you need. In the properties window find the field - FileNotFoundPage and paste the name of error page (copied from sps404.html). Do that for both applications and save it. That's it - You all set.

_________________________________________________________________

Microsoft suggest follow steps below. You can find original article here.


How to point to a custom 404 error Web page in Windows SharePoint Services 3.0 or in Microsoft Office SharePoint Server 2007


To configure Windows SharePoint Services 3.0 or SharePoint Server 2007 to point to a custom 404 error Web page, follow these steps.

Note Because of a design limitation, the custom 404 error Web page does not work when you access invalid site collections.



  1. Log on to the computer that is running SharePoint Server 2007 by using an account that has administrative permissions.
  2. In Windows Explorer, locate the following folder:

    %systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\LangID

    Notes
    • In this path, %systemdrive% represents the actual drive name of the drive on which the operating system is installed.
    • In this path, LangID represents the actual language ID of the language that you use. For example, 1033 is the language ID for U.S. English.
  3. Create the custom HTML file. To do this, use the appropriate method.

    Microsoft Office SharePoint Server 2007


    loadTOCNode(3, 'moreinformation');
    1. On the computer that is running SharePoint Server 2007, copy the Sps404.html file to a temporary folder.
    2. Rename the Sps404.html file. For example, give the file the following name:

      Custom404.html

    3. Add the custom content to the Custom404.html file.
    4. Copy the Custom404.html file to the %systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\LangID folder.

    Windows SharePoint Services 3.0


    loadTOCNode(3, 'moreinformation');
    1. On the computer that is running Windows SharePoint Services 3.0, locate the existing Error.htm file in the following folder:

      %systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\LangID

      Notes
      • In this path, %systemdrive% represents the actual drive name of the drive on which the operating system is installed.
      • In this path, LangID represents the actual language ID of the language that you use. For example, 1033 is the language ID for U.S. English.


    2. Copy the Error.htm file to a temporary folder.
    3. Rename the Error.htm file. For example, give the file the following name:

      Custom404.htm

    4. Modify the Custom404.htm file as required.
    5. Copy the Custom404.htm file to the %systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\LangID folder.


  4. Create a custom console application by using Microsoft Visual Studio 2005 Professional Edition or Microsoft Visual Studio 2005 Standard Edition. Then, add the following code to the custom console application.

  5. // The following code assumes that a reference is made to Microsoft.SharePoint.



    Microsoft.SharePoint.Administration.SPWebApplication webapp =

    Microsoft.SharePoint.Administration.SPWebApplication.Lookup(new Uri("http://"));

    webapp.FileNotFoundPage = "";

    webapp.Update();




    Notes


    • In this code, <serverurl> represents the actual URL of the computer that is running SharePoint Server 2007.

    • In this code, <Custom404.htm> represents the actual name that you created for the custom HTML file.

    For more information about how to create a custom console application by using Visual Studio 2005, visit the following Microsoft Web site:

    http://msdn2.microsoft.com/en-us/library/ms438026.aspx (http://msdn2.microsoft.com/en-us/library/ms438026.aspx)

    Note By default in Windows SharePoint Services 3.0 and in SharePoint Server 2007, the FileNotFoundPage property is set to the "null" setting.


  6. Run the custom console application on the computer that is running SharePoint Server 2007.

Note By default in Windows Internet Explorer, the Show friendly HTTP error messages setting is turned on. In this case, the custom error page may not appear. For more information about this setting, click the following article number to view the article in the Microsoft

Monday, February 9, 2009

CabLib Compress ERROR: Could not flush cabinet: Could not create cabinet file Title is required

If you get this error during building WSP it is because your files have “read only" properties. Check Out files (in Visual Studio or another editor) or Right Click folder -> Properties and Uncheck "Read only".
Build WSP again.

Saturday, January 24, 2009

The search request was unable to connect to the Search Service.

In order to resolve this error "The search request was unable to connect to the Search Service.":
1. Go to the server:
Run > Type “Services.msc” - >
- Start a SharePoint search service;
- Start Indexing service;
- IISReset
 
Sell my car, Used car for sale, Free Automotive Classifieds