Wednesday, February 27, 2008

Trusted file locations

  • Trusted file locations - Allow the Shared Services administrator to determine which locations are supported by Excel Services in SharePoint 2007.

  • These locations can be Windows SharePoint Services, UNC, or HTTP locations.

  • Excel Services in SharePoint 2007 allows end users to perform Microsoft Excel-based functionality without actually having Excel locally installed on their system. Users can calculate, manipulate, and modify Excel spreadsheets directly from a web browser.

  • Excel Services is managed by shared services.

Microsoft SharePoint 2007 Unleashed

Tuesday, February 26, 2008


Reasons why we cannot move to xhtml at this stage:

Should we move to html 4.01?

  • If you are currently using html 4.0 and you want to move to html 4.01


  • W3C recommends that user agents and authors (and in particular, authoring tools) produce HTML 4.01 documents rather than HTML 4.0 documents.
    HTML 4.01 Specification
  • More browsers consider html 4.01 as 'almost standard' or 'standard' mode as opposed to 'Quirks' mode than html 4.0
    Quirks mode
  • If you are using W3C validator to validate page against html 4.0, then you cannot have "name" attribute on the form tag. Whereas html 4.01 is fine.
    W3C Markup Validation Services
  • Going through the changes between 4.0 and 4.01, cannot find any significant disadvantages of using 4.01
    Changes between 24 April 1998 HTML 4.0 and 24 December 1999 HTML 4.01 versions
  • Visual Studio 2008 does support html 4.01 validation, but does not support html 4.0 validation.


  • If we move to 4.01, most cm public pages needs to be tested, time is an issue, also HTML 5.0 is soon to be here, might be worth the wait.
    HTML 5

Sample Stuffs that cannot be validated by html 4.0:

  • Name attribute of the form tag cannot be validated, but we cannot remove it since it's crucial to have it for the javascript to work.
    Having problems validating these forms?
  • Control id start with underscore cannot be validated, but most viewstate's id starts with underscore. e.g. id="__VIEWSTATE"
  • Runat attribute of any HtmlControls cannot be validated. e.g. cannot be validated

For your information:

  • Browser Rendering Modes:
    S = Standards mode
    A = Almost standard mode
    Q = Quirks mode:
  • IE in quirks mode is meant to be backward-compatible with the Internet of the past.
  • When in standards mode, IE uses the W3C box model, but in quirks mode IE uses the Microsoft box model
  • Some CSS features don't work in quirk mode, but do work in standards mode. Aligning an element using the auto keyword in conjunction with the margin property is one such quirks mode incompatibility.
  • Comparison of document types
    Quirks mode
  • HTML 4.01 specifies three document types:
    1) HTML Strict DTD
    2) HTML Transitional DTD
    3) Frameset DTD
  • XHTML 1.0 specifies three XML document types:
    1) XHTML Strict DTD
    2) XHTML Transitional DTD
    3) XHTML Frameset DTD
  • Transitional vs. Strict Markup
  • CSS vs. Tables

Application definition file

  • The Business Data Catalog in SharePoint 2007 allows a MOSS 2007 site to pull information from line-of-business applications, such as Siebel or SAP, without writing custom code.
  • The first step to setting up an external data source for the Business Data Catalog is to define the application with an application definition file.

Microsoft SharePoint 2007 Unleashed

CMS Assessment Tool

The CMS Assessment Tool helps identify valuable information that can help you plan for issues that might arise when you migrate an application from the MCMS 2002 platform to Office SharePoint Server 2007.

Assessing and Analyzing Your MCMS 2002 Application for Migration

Monday, February 25, 2008

SharePoint 2007 Versions

SharePoint 2007 Products:

  • Windows SharePoint Services 3.0 (WSS 3.0)—The Windows SharePoint Services 3.0 product is a free (value-add) product that can be downloaded from Microsoft and installed on any Windows Server 2003 system without any additional licensing (aside from the server itself). It provides core document management, collaboration, and basic search.

  • Office SharePoint Server 2007 Standard. MOSS standard builds on top of WSS to provide portal, advanced search, and enterprise content management.

  • Office SharePoint Server 2007 Enterprise. MOSS enterprise builds on top of MOSS standard to include Business Process, InfoPath forms services, Excel services, Business Data Catalog, Business Intelligence and Business Data Search.

  • Microsoft Office SharePoint Server for Search 2007 (Standard Edition)—This product was created for those organizations that simply need search capabilities, but do not yet require the document management and collaboration features of the full MOSS 2007 product.

  • Microsoft Office SharePoint Server for Search 2007 (Enterprise Edition)—The Enterprise Edition of MOSS 2007 for Search adds additional search providers to the product and allows for additional scaling options.

Essential SharePoint 2007
Microsoft SharePoint 2007 Unleashed

The green shaded areas are provided by WSS and since MOSS builds on WSS, the entire pie is delivered by MOSS. MOSS specifically provides the portal, search, enterprise content management, business process and forms, and business intelligence pieces.

An Overview of Microsoft Office SharePoint Server 2007

Sunday, February 24, 2008

SharePoint 2007 Site Columns

Site Columns are the “properties” of a particular type of content. For example, the Site Columns of a Document Content Type might include Name, Description, Author, Status (such as Draft or Final), or Region. Site Columns can also be defined across the entire portal or for an individual site or site collection. This is one of the most exciting features of MOSS 2007, because “global” metadata management was not available in SharePoint 2003.

Essential SharePoint 2007

SharePoint 2007 content types

  • A common problem with the freewheeling nature of document authoring tools is that users can create as many documents as they want. This can create a problem for organizations when it comes time to find documents later, because the user may or may not have used a consistent naming scheme, may or may not have tagged the document with metadata properties, or may or may not have used a consistent, discoverable location for storage.
  • SharePoint provides a feature called content types, which enable an organization to create a defined set of site columns and document templates for a given purpose. This enables users to select from a predefined set of published document templates and site columns, making it easy to maintain consistent document formats and storage locations. Content types can include an associated document template, required metadata columns, and consistent workflow and retention policies.
  • A Content Type is a collection of settings that define a particular type of information, such as a project plan or financial report. A Content Type can be defined at the portal level or at the site level and reused across multiple document libraries and sites.
  • It is often difficult to find related information when you are searching through a large repository. For example, if you would like to create a project plan for a new project, but you know that there have been many other projects similar to yours in the past. In a portal with several project team sites, it would be difficult to find all of the project plans. Content Types in Office SharePoint Server 2007 help simplify the process. If you define Project Plan as a Content Type, you could find all project plans in your portal easily with a single search.
  • Here are a sample of Content Types other organizations have found useful. ■ Brochure ■ Case Study ■ Checklist ■ Form ■ Form Letter ■ Lesson Learned ■ Manual ■ Organization Chart ■ Policy ■ Presentation ■ Procedure ■ Project Plan ■ White Paper
  • Content Types can be created at the site or site collection level and can “inherit” properties from a parent Content Type. For example, while a memo is an “instance” of a document, if your organization wants users to leverage a standard template when creating a memo, you will want to create a new Content Type called Memo that may be a “child” of the parent Content Type called Document. The Memo Content Type can inherit all of the properties of the Document Content Type but can leverage a different template.

Windows SharePoint Services 3.0 content types:

  • Document content types—Basic Page, Document, Dublin Core Columns, Form, Link to a Document, Master Page, Picture, Web Part Page
  • Folder content types—Discussion, Folder
  • List content types—Announcement, Contact, Event, Far East Contact, Issue, Item,Link, Message, Task
  • Special content types—Unknown Document Type

SharePoint Server 2007 content types:

  • Business Intelligence Content Types—Dashboard Page, Indicator using data in Excel workbook, Indicator using data in SharePoint list, Indicator using in SQL Server Analysis Services, Indicator using manually entered information, Report
  • Document content types—Same as with Windows SharePoint Services 3.0
  • Folder content types—Same as with Windows SharePoint Services 3.0
  • List content types—Same as with Windows SharePoint Services 3.0
  • Page layout content types—Article Page, Redirect Page, Welcome Page
  • Publishing content types—Page, Page Layout, Publishing Master Page
  • Special content types—Same as Windows SharePoint Services 3.0

Microsoft SharePoint 2007 Unleashed

Essential SharePoint 2007

SharePoint 2007 Libraries & Lists

Some of the advantages provided by a SharePoint document library include the following:

  • The administrator of a document library has a great deal of control over who can add, modify, and delete documents, or just read them.
  • Versioning can be turned on for a document library that keeps a complete copy of previous versions of the document for reference or recovery purposes.
  • Alerts can be set on a document within the library or for the entire library so that the user receives an email notification if a document is modified, added, or deleted.
  • Documents can be checked out, with the name of the person who has the document checked out listed in the library, so that other users can’t modify the document.
  • A template can be stored in the document library that can be used to create a new document that is stored in the library by default.
  • Metadata can be added to a document library that enables users to better describe what the document contains, which client it belongs to, how many pages it is, or pretty much any other kind of textual or numeric information.
  • Views can be created that group documents by certain criteria, sort them by any of the columns in the library, or only display documents that meet certain criteria.
  • The ability to search within the library for text contained within the document is a feature often not available on a corporate network. In addition, the ability to search the metadata associated with a document.
  • If the organization decides on certain standards for the customization of a document library, it can create a template that can be used in other sites.

In SharePoint Server 2007, libraries are as follows:

  • Document Library
  • Form Library
  • Wiki Page Library
  • Picture Library
  • Translation Management Library
  • Report Library
  • Data Connection Library
  • Slide Library

In Windows SharePoint Services version 3, libraries are as follows:

  • Document Library
  • Form Library
  • Wiki Page Library
  • Picture Library

The standard lists available in SharePoint 2007 and Windows SharePoint Services version
3 are as follows:

  • Announcements list
  • Contacts list
  • Discussion Board list
  • Links list
  • Calendar list
  • Tasks list
  • Project Tasks list
  • Issue Tracking list
  • Survey list
  • Custom list
  • Custom list in Datasheet view
  • KPI list (SharePoint Server 2007 only)
  • Languages and translators (SharePoint Server 2007 only)
  • Import spreadsheet

Microsoft SharePoint 2007 Unleashed

Saturday, February 23, 2008

Option Strict Statement

1. If turn the option strict off, it allows implicit type conversion

2. If turn on, the compiler will alert your the conversion is not allowed

3. Here is another example

4. if you turn if off, the conversion error will appear in run time

  • C# is a strongly typed language. VB.NET, on the other hand, is not by default, unless you turn on the Option Strict option.
  • Option Strict On prevents implicit type conversions by the compiler.
  • Set Option Strict to On to improve type checking of your VB.NET code. On rare occasions, you may find setting Option Strict Off to be of benefit, especially when you need to interoperate with late-binding COM Components exposing only the IDispatch interface. In these cases, set Option Strict Off only in those isolated files (classes) that interact with the components.

.NET Gotchas

Thursday, February 21, 2008

Encrypt Web.config 2 has new features that you can encrypt the web.config programatically.

#Region "Protect/Unprotect Methods"

// Code taken verbatim from David Hayden's blog []

// Entry: Encrypt Connection Strings AppSettings and Web.Config in ASP.NET 2.0 - Security Best Practices

// []

private void ProtectSection(string sectionName,

string provider)


Configuration config =



ConfigurationSection section =


if (section != null &&







private void UnProtectSection(string sectionName)


Configuration config =



ConfigurationSection section =


if (section != null &&








Chris Blankenship provides a page which allows you to encrypt the web.config based on sections of the web.config. Once you encrypted the section, the application will still be running without problem, you don't have to decrypt it for the program to use it, it does it automatically.

Encrypt that Web.Config

RadioButtonList Selected Value

David Seruyange blogged about how to get the selected value of the radiobuttonlist through javascript which is a very useful tip:

<script type="text/javascript">

function getRadioSelectedValue(radioList)


var options = radioList.getElementsByTagName('input');



var opt = options[i];

if (opt.checked)


return opt.value;





radioList is the clientid of the radiobuttonlist.

RadioButtonList Javascript Accessible

Wednesday, February 20, 2008


  • Identifies a container control that creates a new ID namespace within a Page object's control hierarchy. This is a marker interface only.
  • Any control that implements this interface creates a new namespace in which all child control ID attributes are guaranteed to be unique within an entire application. The marker provided by this interface allows unique naming of the dynamically generated server control instances within the Web server controls that support data binding. These controls include the Repeater, DataGrid, DataList, CheckBoxList, ChangePassword, LoginView, Menu, SiteMapNodeItem, and RadioButtonList controls.
  • When you develop templated controls, you should implement this interface to avoid naming conflicts on a page.
  • FindControl searches the current naming container for the specified server control.
  • A naming container is any control that implements the INamingContainer interface. Both the MasterPage and Content controls are naming containers. FindControl only searches inside the current naming container.
  • A naming container also mangles its children’s ClientID property. Mangling ensures all ClientID properties are unique on a page. For instance, the ID for a Label control is “Label1”, but the ClientID of the Label is “ctl00_ContentPlaceHolder1_Label1”. Each level of naming container prepends it’s ID to the control (the MasterPage control ID in this form is ctl00).
  • So when a Control is a naming container, the UniqueID for all controls within it will have the parent's ID as a prefix. So while a child control might have ID "foo", its UniqueID will be "parentID$foo" (where parentID = the ID of the parent).

INamingContainer Interface

TRULY Understanding Dynamic Controls (Part 4)

ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps

Tuesday, February 19, 2008

File Upload

There are two ways to upload a file in ASP.NET:

If Not hiddenFile.PostedFile Is Nothing And hiddenFile.PostedFile.ContentLength > 0 Then

Dim fn As String = System.IO.Path.GetFileName(hiddenFile.PostedFile.FileName)

Dim SaveLocation As String = Server.MapPath("images") & "\" & fn



Response.Write("The file has been uploaded.")

Catch Exc As Exception

Response.Write("Error: " & Exc.Message)

End Try


Response.Write("Please select a file to upload.")

End If

Dim myFile As HttpPostedFile = hiddenFile.PostedFile 'or you can use Request.Files("hiddenFile")

If myFile IsNot Nothing Then

Dim nFileLen As Integer = myFile.ContentLength

If nFileLen > 0 Then

Dim myData As Byte() = New Byte(nFileLen - 1) {}

myFile.InputStream.Read(myData, 0, nFileLen)

Dim strFilename As String = Path.GetFileName(myFile.FileName)

WriteToFile(Server.MapPath(strFilename), myData)

End If

End If

Private Sub WriteToFile(ByVal strPath As String, ByRef Buffer As Byte())

Dim newFile As New FileStream(strPath, FileMode.Create)

newFile.Write(Buffer, 0, Buffer.Length)


End Sub

If you take a look at the SaveAs method of HttpPostedFile using reflector, you will notice that the above two methods of uploading file are the same.

Public Sub SaveAs(ByVal filename As String)

If (Not Path.IsPathRooted(filename) AndAlso RuntimeConfig.GetConfig.HttpRuntime.RequireRootedSaveAsPath) Then

Throw New HttpException(SR.GetString("SaveAs_requires_rooted_path", New Object() {filename}))

End If

Dim s As New FileStream(filename, FileMode.Create)






End Try

End Sub

File Upload with ASP.NET

How to upload a file to a Web server in ASP.NET by using Visual Basic .NET